To start the server in development mode
- create a
.env
file in the root folder, you can make use of.env.sample
as a template. - add a port address to your
.env
file - You will need to create a mongoDB project and get your
MONGODB_URI
connection string. - You will also store your username and mongodb password inside your
.env
file
Then run
npm install
Start the server
npm run dev
BASE_URL= http://localhost:{port}/api
api endpoints
Note: the user_id will be replaced with the actual user_id from that is automatically generated by MONGODB
POST /api
req.body = "David Bodunrn"
response = {
"message": "ok",
"user": {
"fullName": "David Bodunrin",
"_id": "6504c01cd3c248137626ab90",
"__v": 0
}
}
GET /api/:user_id
response = {
"message": "ok",
"user": {
"_id": "6504c74f2525553f0b036c50",
"fullName": "David Bodunrin",
"__v": 0
}
}
PATCH /api/:user_id
req.body = "James Bodunrin"
response = {
"message": "ok",
"user": {
"_id": "6504c74f2525553f0b036c50",
"fullName": "James Bodunrin",
"__v": 0
}
}
DELETE /api/:user_id
response = {}
GET https://zuri-stage-2-1rmd.onrender.com/api/6504c74f2525553f0b036c50
response = {
"message": "ok",
"user": {
"_id": "6504c74f2525553f0b036c50",
"fullName": "David Bodunrin",
"__v": 0
}
}
PATCH https://zuri-stage-2-1rmd.onrender.com/api/6504c74f2525553f0b036c50
req.body = "James Bodunrin"
response = {
"message": "ok",
"user": {
"_id": "6504c74f2525553f0b036c50",
"fullName": "James Bodunrin",
"__v": 0
}
}
DELETE https://zuri-stage-2-1rmd.onrender.com/api/6504c74f2525553f0b036c50
response = {}
BASE_URL=https://zuri-stage-2-1rmd.onrender.com/api