The purpose of this project is to gain some practical experience on how to build an basic API server with Express.js, by achieving the following tasks:
-
build up a basic express server with GET, POST, PUT, DELETE methods
-
utilise middleware
-
structure the project, so it's more maintainable and clean
There is no database in this project, memory used to mimic the data storage
-
simply fork this project to start with or create your own
-
there are progressive branches for each step listed below, switch to them at your need
- init the project and install express
npm init --yes
npm i express
-
setup an express server
-
build up the server with CRUD operations
- we don't have database, but we will mock one
-
explain a better project structure
-
extract common logic to middleware
-
extract routes into separate modules
-
NODE_ENV
-
PORT