Saturday, 29 April 2017

how to break in middleware in expressjs

I have a MEAN stack based web application and I have a middle ware which validates the request for some authorization purpose.. I have written the security checking part..but if the user is unauthorized , the express middle ware should stop execution and return back user 401 status with a message.. How can I achieve it? I tried to to use return statement in middle ware ;but its not working. Though some of them works , it throws exception and breaks the server . I want just an abrupt ending to the request. Any help will be appreciated.



via Jocket

No comments:

Post a Comment