Build a REST API with ExpressJS
- Fork this repository then clone it on your computer
- install Insomnia (or your API Testing tool of choice)
- Paste your .env file from workshop2 containing credentials to your Mongo Database
⚠ Commit your changes after each instruction, following the commit message format:
feat(1): Initiate NPM Project
- Install existing packages with
npm install
npm install
- Add NPM packages
express
Mongoose is a package making mongo request easier and more secure
npm install --save express
- Put your database credentials in a file named
.env
(from Workshop2) - Take a look at the architecture
One Folder per entity. In each folder, 3 files:
entity.controller.js -> Presentation Layer, API
entity.service.js -> Business Logic Layer
entity.model.js -> Database Layer
- Implement a "Hello World" route, on GET / that returns "Hello World"
- Visit the route at http://localhost:3000/
- Create the API CRUD for Location
- Create routes at Presentation Layer
- Implement business logic in the Location Service
For reference, CRUD: Create: /locations Update: /locations/:id Request (Get All: /locations , Get One: /locations/:id) Delete: /locations/:id