by smt88 · 9y ago · 0 comments
If you don't know what method is going to be called on your class, there's something wrong with your code. I'm assuming this either happens when A) your input isn't validated/sanitized (generic routing allows any method on your class to be called) or B) you're coding sloppily.
In the case of A, you need to validate your routing. If a user calls a route that doesn't exist, they should get a 404. This can become a security issue if you don't do it.
In the case of B, JS already tells you that the method isn't defined. Or, if you're using a good IDE, JSLint, TypeScript, or Flow, you should see a warning before you run your code.