Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Middleware function mUST come before the other route handlers!
- */
- app.use((req, res, next) => {
- res.locals.SOURCE = '/container_name' + req.originalUrl
- next()
- })
- app.use('/foo', require('./routes/foo'))
- app.use('/bar', require('./routes/bar'))
- /*
- In route file (ie. /routes/foo.js)
- ALL responses should follow this exact format, using either 'msg', 'err', or 'data' where needed!
- */
- res.status(200).json({
- status: 200,
- msg: `[Success]: ...`,
- source: res.locals.SOURCE
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement