I have a router which has multiple routes. Currently, I am escaping every parameter being passed to the method separately in the method itself.
I need to escape all the parameters which are being passed in the URL for security purpose.
class MyRouter extends Backbone.Router
routes:
"student/:id/:name" : "student"
"teacher/:tid/:tname" : "teacher"
"teacher/:tid/:tname/share" : "teacher_share"
student: (id, name) ->
id = _.escape(id)
name = _.escape(name)
#do stuff
teacher: (tid, tname) ->
tid = _.escape(tid)
tname = _.escape(tname)
#do stuff
teacher_share: (tid, tname) ->
tid = _.escape(tid)
tname = _.escape(tname)
#do stuff
Is it possible to escape all the parameters in all the routes at once, so that I don't have to explicitly escape them in every respective method?
You can override
execute