We will edit the app.js
file to add routes to the band-list.html
view and also their respective controller:
Open
app.js
and add the following lines after the index controller import:// Inject band controller var bands = require('./controllers/band'); // Inject user controller var users = require('./controllers/user');
Add the following code after the index route
app.get('/', index.show);
:// Defining route to list and post app.get('/bands', bands.list); // Get band by ID app.get('/band/:id', bands.byId); // Create band app.post('/bands', bands.create); // Update app.put('/band/:id', bands.update); // Delete by id app.delete('/band/:id', bands.delete); // Defining route to list and post users app.get('/users', users.list); app.post('/users', users.create);
At this moment, we have almost all of the application working; let's...