May 2018
Intermediate to advanced
492 pages
12h 3m
English
Now, let's look at creating notes. Because the application doesn't have a route configured for the /notes/add URL, we must add one. To do that, we need a controller for the notes.
In app.js, make the following changes.
Comment out these lines:
// var users = require('./routes/users');
..
// app.use('/users', users);
At this stage, the Notes application does not support users, and these routes are not required. That will change in a future chapter.
What we really need to do is add code for the notes controller:
// const users = require('./routes/users');
const notes = require('./routes/notes');
..
// app.use('/users', users);
app.use('/notes', notes);
Now, we'll add a Controller module containing the notes router. ...
Read now
Unlock full access