This is boilerplate/starter project for quickly building RESTful APIs using Node.js and Express, written in JavaScript. It will help you get started with a simple to follow format with some examples for routes, logging and middleware.
- morgan- HTTP request logger middleware for Node.js
- dotenv- Loads environment variables from
.envfile intoprocess.env - cors- CORS provides a Connect/Express middleware that can be used to enable CORS with various options.
- nodemon- Helps develop node.js based application by automatically restarting the node server when it detects application file changes.
yarn
yarn dev
The server runs a simple Express API server
/ returns status: ok
/hello returns message: Hello World!
Unknown endpoints are handled in a middleware file.
The hello route is defined in the helloRoute
src\
|--routes\ # Routes
|--utils\ # Utility files
|--app.js # Express app
|--index.js # App entry point