Skip to content

Instantly share code, notes, and snippets.

@nomanHasan
Created September 7, 2017 20:31
Show Gist options
  • Save nomanHasan/744672904cc5462bfdc04e53bd727fb5 to your computer and use it in GitHub Desktop.
Save nomanHasan/744672904cc5462bfdc04e53bd727fb5 to your computer and use it in GitHub Desktop.
Add API route to app.js
// Other Require statements ...
var index = require('./routes/index.route');
var users = require('./routes/users.route');
// Get the API route ...
var api = require('./routes/api.route')
// Other stuffs ...
//Use the Routes
app.use('/', index);
app.use('/users', users);
//Use the API routes for all routes matching /api
app.use('/api', api);
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment