Route-401 is an express style router.
The callback for all routes takes a "request" and a "response" argument. There is functionality to add request parameters, but only one. These are accessible through the req.params object. Ex:
app.get('/files/:file', (req, res) => { // this will work
console.log(req.params.file); // will log the file name you requested
});
app.get('/:user/files/:file') // this will NOT work
Here is an example of how to set up your router:
const http = require('http');
const Router = require('route-401');
const app = new Router();
app.get('/', (req, res) => {
// Do Stuff
});
app.post('/uploads', (req, res) => {
// Do Stuff
});
app.delete('/uploads/:file', (req, res) => {
// Delete Stuff
});
http.createServer(app.serverCallback()).listen(3000, () => {console.log('server up');});