Structure

We will structure our application in a simple and modular manner, following a slight modification of the MVC architectural pattern.

We will create controllers in a controllers folder, which will house the business logic for our application. Our data objects will also sit in a similarly named models folder. We will also create a middleware folder to house our application's middleware functions.

An index.js file will be created to serve as the entry point for our server. We will load up the required dependencies, configure our middleware, and start our server from this file.

To create the required folders, we can run the following command in the Terminal:

mkdir controllers middleware models

To create the entry point file, we can run the following command in the Terminal:

touch index.js

After initialization, and having created the required folders and files, the structure should look as follows:

├── controllers
├── index.js
├── middleware
├── models
├── package-lock.json
└── package.json
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.39.23