I am using node js with an expression. Now I need to perform a common action for all ex requests. cookie verification
app.get('/',function(req, res){ //cookie checking //other functionality for this request }); app.get('/show',function(req, res){ //cookie checking //other functionality for this request });
Here, checking cookies is a common action for all requests. So, how can I accomplish this without repeating the cookie verification code in all app.get.
Suggestions for fixing this? thanks in advance
Kumar source share