meanjs / mean

MEAN.JS - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js -
http://meanjs.org
MIT License
4.87k stars 1.98k forks source link

Placement of middleware #1562

Open frkwhiteangel opened 8 years ago

frkwhiteangel commented 8 years ago

Lets say im going to use a middleware to all post requests to the server.

is there a core place i could place / put this middleware function so i dont need to Call a New file for it on every modules?

sujeethk commented 8 years ago

AFAIK, express.js file has most of the common middleware for the app in order. Maybe you could add your necessary middleware somewhere down there?

frkwhiteangel commented 8 years ago

Would that support database query's?

Im going to save to db

Den lørdag 15. oktober 2016 skrev Sujeeth notifications@github.com følgende:

AFAIK, express.js https://github.com/meanjs/mean/blob/master/config/lib/express.js file has most of the common middleware for the app in order. Maybe you could add your necessary middleware somewhere down there?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/meanjs/mean/issues/1562#issuecomment-254010400, or mute the thread https://github.com/notifications/unsubscribe-auth/AJHUrLZ_qZmv3GwlE7yNwmv3foGqK_yOks5q0T0MgaJpZM4KVnIG .

sujeethk commented 8 years ago

I am not sure of what you are trying to accomplish, but that file is already connected to mongostore for saving sessions, so you shouldn't have trouble including your own middle-ware writing to db.

frkwhiteangel commented 8 years ago

Im trying to accomplish to get all parameters in req.query and get req.user. Id and save it to the db :)

Will look into it

Den lørdag 15. oktober 2016 skrev Sujeeth notifications@github.com følgende:

I am not sure of what you are trying to accomplish, but that file is already connected to mongostore for saving sessions, so you shouldn't have trouble including your own middle-ware writing to db.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/meanjs/mean/issues/1562#issuecomment-254011092, or mute the thread https://github.com/notifications/unsubscribe-auth/AJHUrM24cHVxVGkyRqng_iyc_6Cew_dcks5q0UA5gaJpZM4KVnIG .