Back End URL: https://art-portfolio-project-back-end.herokuapp.com
Front End URL: https://art-portfolio-project-front-end.netlify.com
method url: /api/register
http method: [POST]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
name | type | required | description |
---|---|---|---|
username |
String | Yes | Must be unique |
password |
String | Yes | |
email |
String | No |
{
"username": "Marion",
"password": "1234",
"email": "[email protected]",
}
{
"id": 8,
"username": "Marion",
"password": "1234",
"email": "[email protected]"
}
{
"errorMessage": "Missing required fields."
}
method url: /api/login
http method: [POST]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
name | type | required | description |
---|---|---|---|
username |
String | Yes | must be registered user |
password |
String | Yes |
{
"username": "Elliot",
"password": "1234",
}
{
"userId": 5,
"username": "Elliot",
"email": "[email protected]",
"message": "Welcome Elliot!",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo1LCJ1c2VybmFtZSI6IkVsbGlvdCIsImVtYWlsIjoiZWxsaW9
0QGdtYWlsLmNvbSIsImlhdCI6MTU1NTYyMTQ4NCwiZXhwIjoxNTU1NjI1MDg0fQ.k4XzOQi-eElnSkdqReipzowTMugtvjiNcHkxH8kdIfw"
}
{
"errorMessage": "Missing username or password."
}
{
errorMessage: "Invalid credentials."
}
method url: /api/users
http method: [GET]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize request |
[
{
"id": 1,
"username": "Diana",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
},
{
"id": 2,
"username": "Carmen",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
},
{
"id": 3,
"username": "Louis",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
},
{
"id": 4,
"username": "John",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
},
{
"id": 5,
"username": "Elliot",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
},
{
"id": 6,
"username": "Doug",
"password": "$2a$10$1eS0iEPTFWCHzS9hGAIvp.K5xbpvp5DMqkXNaTHoGt.y4qU3cK2i.",
"email": "[email protected]"
}
]
method url: /api/users/:id
http method: [GET]
[
{
"id": 5,
"username": "Elliot",
"password": "$2a$10$vBEEx72D56pUbuzQ0ne5VeeHzkhpi/i7YzVsKOP/N5OAoFSGN7ifi",
"email": "[email protected]"
}
]
{
"message": "The user with the specified ID does not exist."
}
method url: /api/users/:id
http method: [DELETE]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize request |
{
"message": "The user with the id 9 has now been removed from the database."
}
{
"error": "No token provided, must be set on the Authorization Header"
}
{
"name": "JsonWebTokenError",
"message": "invalid token"
}
method url: /api/users/:id
http method: [PUT]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize request |
Should return the updated record
{
"user": {
"id": "9",
"username": "Arthur",
"password": "$2a$12$SH/1wKf05udS4ggLzBA3Ee3J0jI0nBIEhFJe1h9tbsNFxdGXsibci",
"email": "[email protected]"
}
}
{
"error": "No token provided, must be set on the Authorization Header"
}
{
"name": "JsonWebTokenError",
"message": "invalid token"
}
method url: /api/posts
http method: [GET]
[
{
"id": 1,
"postName": "Weekday Trip to Paris",
"description": "I had the most wonderful time because I don't have a job",
"imageUrl": "https://loremflickr.com/g/320/240/paris",
"userId": 1,
"upvotes": [
4,
5,
7,
8
]
},
{
"id": 2,
"postName": "A man's best friend",
"description": "I love my dog",
"imageUrl": "https://loremflickr.com/320/240/dog",
"userId": 2,
"upvotes": [
1,
4,
7,
9
]
},
{
"id": 3,
"postName": "Beautiful portrait",
"description": "Just as beautiful as the Mona Lisa",
"imageUrl": "https://loremflickr.com/320/240/paris,girl/all",
"userId": 3,
"upvotes": [
1,
7,
8
]
},
{
"id": 4,
"postName": "Morning ritual",
"description": "There's nothing better than a cup of coffee in the morning",
"imageUrl": "https://loremflickr.com/320/240/coffee",
"userId": 4,
"upvotes": [
2
]
},
{
"id": 5,
"postName": "Sunday mood",
"description": "My favorite past time activity",
"imageUrl": "https://loremflickr.com/320/240/sleep",
"userId": 5,
"upvotes": [
1,
4
]
},
{
"id": 6,
"postName": "Exploring nature",
"description": "Summer is here!",
"imageUrl": "https://loremflickr.com/320/240/sun",
"userId": 6,
"upvotes": [
2,
4
]
},
{
"id": 7,
"postName": "Wonderful sculpture",
"description": "Pretty statue I found during my adventures",
"imageUrl": "https://loremflickr.com/320/240/statue",
"userId": 1,
"upvotes": [
1,
4
]
},
]
method url: /api/posts/:id
http method: [GET]
{
"id": 9,
"postName": "My Birthday",
"description": "Happy Birthday to me!",
"imageUrl": "https://loremflickr.com/320/240/cake",
"userId": 1
}
{
"message": "The post with the specified ID does not exist."
}
method url: /api/posts/?userId=${userId}
http method: [GET]
[
{
"id": 2,
"postName": "A man's best friend",
"description": "I love my dog",
"imageUrl": "https://loremflickr.com/320/240/dog",
"userId": 2,
"upvotes": [
1,
4,
7,
9
]
},
{
"id": 8,
"postName": "People watching",
"description": "I like taking pictures of people",
"imageUrl": "https://loremflickr.com/320/240/man",
"userId": 2,
"upvotes": [
1
]
}
]
method url: /api/posts
http method: [POST]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize request |
name | type | required | description |
---|---|---|---|
postName |
String | Yes | |
imageUrl |
String | Yes | |
description |
String | No |
{
"postName": "A man's best friend",
"imageUrl": "https://loremflickr.com/320/240/dog",
"description": "A picture of my dog",
}
{
"id": 13,
"postName": "A man's best friend",
"description": "I love my dog",
"imageUrl": "https://loremflickr.com/320/240/dog",
"userId": 5,
"upvotes": []
}
{
"No token provided, must be set on the Authorization Header"
}
{
"name": "JsonWebTokenError",
"message": "invalid token"
}
method url: /api/posts/:id
http method: [PUT]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize request |
name | type | required | description |
---|---|---|---|
postName |
String | No | |
imageUrl |
String | No | |
description |
String | No |
{
"postName": "A man's best friend",
"description": "I love my dogs",
"imageUrl": "https://loremflickr.com/320/240/dog"
}
{
"postName": "A man's best friend",
"description": "I love my dogs",
"imageUrl": "https://loremflickr.com/320/240/dog",
"id": 13,
"userId": 5,
"upvotes": []
}
{
"error": "No token provided, must be set on the Authorization Header"
}
{
"name": "JsonWebTokenError",
"message": "invalid token"
}
method url: /api/posts/:id (where id is the id of the post
http method: [DELETE]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
{
"message": "The post with the ID 2 has now been removed from the database."
}
{
"error": "No token provided, must be set on the Authorization Header"
}
{
"name": "JsonWebTokenError",
"message": "invalid token"
}
method url: /api/posts/upvotes/:postId
http method: [GET]
{
"success": true,
"postId": "13",
"upvotes": 0
}
{
"message": "The post with the specified ID does not exist."
}
method url: /api/posts/upvote/:postId
http method: [PUT]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
{
"success": true,
"userId": 5,
"postId": "3"
}
{
"errorMessage": "Like already in database"
}
method url: /api/posts/upvote/:postId/:userId
http method: [PUT]
name | type | required | description |
---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
{
"success": true,
"userId": 5,
"postId": "3"
}
{
"errorMessage": "Like not in database"
}