mongoose-model-magic
v1.1.1
Published
express middleware to load mongoose models into request object
Downloads
6
Maintainers
Readme
Mongoose Model Magic
Express middleware to load Mongoose models into request object :zap:
Setup
Install
npm install --save mongoose-model-magic
Require this alongside your router-
import modelMagic from 'mongoose-model-magic';
// Or, for ES5-
// var modelMagic = require('mongoose-model-magic');
Usage
Attach middleware to a specific route.
router.patch('/users/:id', modelMagic('user'), fn);
Or a rule-
router.all('/users/:id*', modelMagic('user'));
Or... anything else you attach Express middleware too. It's native! :clap: