This NodeJS and Express server template contains the basic files, folders, dependencies and basic setup that are needed to start a new quick project.
- Clone this repo it by clicking on the Code (green button) and copy the HTTPS url.
- Open a new terminal, navigate to where you'll like to store this project.
- Now type:
git clone <paste url here>
and press enter. - Change into the project folder, then type:
npm install
. - Finally, let's run the server! type:
npm run dev
Done!
public/
src/
controllers/
errors/
middlewares/
models/
routes/
- Express
- Helmet
- Morgan (dev dependency)
- Nodemon (dev dependency)
-
Static middleware: for serving the public folder.
-
Morgan middleware: for logging.
-
Helmet middleware: for HTTP response headers security.
-
Express/BodyParser middleware: for parsing request bodies. [express.json() and express.urlencoded()]
-
Custom Error handler middleware: for standard error messaging.
Default API test route:
- /api/v1/health-check -> healthCheckRouter
Default API Docs Route: This route can be used to show the API documentation, if desire.
- /docs -> res.send('docs...')