Skip to content

Instantly share code, notes, and snippets.

View anthonywoodard's full-sized avatar

Anthony Woodard anthonywoodard

View GitHub Profile
@pasupulaphani
pasupulaphani / after_res_hooks.js
Last active March 20, 2024 22:23
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups