#qu A simple REST API in Node.js
API Endpoints
| Methods | Urls | Description |
|---|---|---|
| GET | api/employees | Get all employees |
| GET | api/employees/id | Get a specific employee |
| POST | api/employees | Create a new employee |
| PUT | api/employees/id | Update an existing employee |
| DELETE | api/employees/id | Delete an existing employee |
Clone the repo.
https://github.com/zagaris/express-api.git
cd express-apiCreate the .env.dev file.
DB_URL = localhost/my-employees
PORT = 5000Create the .env.prod file.
DB_URL = myhost.me/my-employees
PORT = 8080Install the dependencies.
npm installTo start the express server in dev mode, run the following.
npm run devTo start the express server in prod mode, run the following.
npm run prodFor more details check Build a Restful CRUD API with Node.js.