ProfilesApp Introduction
Nodejs task 3 Zuri training. Create a simple CRUD app.
Task
Connects to a database
Creates the payload
Get's the data created
Updates the data created
Deletes the data created
Authentication
Post information containing title, name, email and country of user. Use Get to gain access to specific or all profiles uploaded. Use Put to update sections of specific profiles. Use Delete to delete profiles.
Error Codes
500 : Internal Server error
404 : Profile not found
400 : Bad request
Rate limit
POST https://agile-cliffs-22236.herokuapp.com/profilesapp
You can add data to database using POST request and raw json data. Data should include title, name, email and country of user.
eg. "profile": { "title": "Evans' Profile", "name": "Evans Adjei", "email": "gyedu.adjei@gmail.com", "country": "Ghana" }
Example
Default
Request
curl
curl --location --request POST 'https://agile-cliffs-22236.herokuapp.com/profilesapp' \
--data-raw ''
No response body
This request doesn't return any response body.
GET https://agile-cliffs-22236.herokuapp.com/profilesapp
Get request allows you access to all profiles in the database
GET https://agile-cliffs-22236.herokuapp.com/profilesapp/609c7acfa88e9d0015eab625
Get by Id allows you access to a specific user's profile by using an Id generated by database. Id will be added to request.
Bodyraw (json)
json
{
"profile": {
"title": "Evans' Profile",
"name": "Evans Adjei",
"email": "gyedu.adjei@gmail.com",
"country": "Ghana"
}
}
PUT https://agile-cliffs-22236.herokuapp.com/profilesapp/609c864aba4d7e0015201c29
Put request to update specific sections of a specific profile
Bodyraw (json)
json
{
"profile": {
"title": "Joshua's Profile",
"name": "Joshua Aboah Rex",
"email": "joe.ab.rex@gmail.com",
"country": "Ghana"
}
}
DEL https://agile-cliffs-22236.herokuapp.com/profilesapp/609c864aba4d7e0015201c29
Delete request to delete a profile based on selected Id inputted in request
Bodyraw (json)
json
{
"profile": {
"title": "Joshua's Profile",
"name": "Joshua Aboah Rex",
"email": "joe.ab.rex@gmail.com",
"country": "Ghana"
}
}
HEROKU LINK: https://git.heroku.com/agile-cliffs-22236.git