Building an Express Application Chapter 2
After that, in our app.js, we need to include our controller files. To do that, we first have
to introduce a new package called filesystem. This module makes it easy to perform
operations related to files, such as reading/writing to the file.
So, to add this package to our application, run:
$ npm install file-system --save
This --save argument is used when we want a node module to only be installed within
our application. Also, after installation, this package will be automatically included in our
package.json.
Now, we will need to require this module and use it to include all of our files that reside in
the controller. For that, add these lines of code in our app.js. Make sure you add these
lines before our web server running code:
var index = require('./routes/index');
var users = require('./routes/users');
var app = express();
// Require file system module
var fs = require('file-system');