README
vanilla_router documentation
To Install:
npm install vanilla_router
To Require:
var router = require('vanilla_router');
To Use:
- Create routes file in routes folder (ex. routes/samplesRoutes.js)
router.get('/samples', (req, res) => { console.log('samples GET route hit'); res.end(); }); router.post('/samples', (req, res) => { console.log('samples POST route hit'); res.end(); }); router.put('/samples', (req, res) => { console.log('samples PUT route hit'); res.end(); }); router.delete('/samples', (req, res) => { console.log('samples DELETE route hit'); res.end(); });
- Add routes to server in server.js
var students = require(__dirname + '/routes/studentsRoutes.js'); var samples = require(__dirname + '/routes/samplesRoutes.js'); students(newRouter); samples(newRouter);
- Add test for routes in test folder (ex. test/samplesRoutes-test.js) *optional