# (1) navigate to your activities directory
$ cd ~/Documents/muktek/activities
# (2) Clone the repo and save it into activity--express-routes
$ git clone https://github.com/agzeri/starter-repo--express-routes.git activity--express-routes
$ cd activity--express-routes
# (3) Install all dependencies
$ npm install
Don’t forget to export the module.
GET /api/courses
POST /api/courses
PUT /api/courses/{id}
DELETE /api/courses/{id}
GET /api/courses/{id}
GET /api/instructors
POST /api/instructors
DELETE /api/instructors/{id}
GET /api/instructors/{id}
GET /api/students
GET /api/students/{id}
POST /api/students
# Courses
[{
id: 1,
name: "Introduction to JavaScript",
length: "15 hours"
}, {
id: 2,
name: "React.js Fundamentals",
length: "25 hours"
}]
# Instructors
[{
id: 1,
name: "Mr R"
}, {
id: 2,
name: "Tyler"
}, {
id: 3,
name: "John Die"
}]
# Students
[{
id: 1,
name: "Damian Allende"
}, {
id: 2,
name: "Cesar Hernandez"
}, {
id: 3,
name: "Ingrid Garcia"
}, {
id: 4,
name: "Maribel Navia"
}]
Hint 1: For DELETE and PUT requests, you can play responding with a message like: "Making a DELETE/PUT request on {course/instructor/students} endpoint with id: «value»"
Test all routes using Postman.
- Send actual data to
POST /api/courses
endpoint.- To do this, you’ll need to capture data from body request. Read more about here.