https://bw-hair-care.herokuapp.com/
Method Url: /api/auth/register
HTTP method: [POST]
| name | type | required | description |
|---|---|---|---|
email |
String | Yes | Must be unique |
password |
String | Yes | |
stylist |
Boolean | No | Pass in true for yes and false for no |
example:
{
email: email@email.com,
password: "password",
stylist:
}
If you successfully register a User the endpoint will return an HTTP response with a status code
201and a body as below.
{
"message": "You have Successfully registered"
}
Users Method Url: /api/users/login
HTTP method: [POST]
| name | type | required | description |
|---|---|---|---|
email |
String | Yes | Must match email in the database |
password |
String | Yes | Must match a password in the database corresponding to above email |
example:
{
email: "email@email.com",
password: "password"
}
If you successfully login, the endpoint will return an HTTP response with a status code
200and a body as below.
{
"message": "Welcome!",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo4LCJ1c2VybmFtZSI6ImVtYUB5YWhvby5jb20iLCJpYXQiOjE1NjE2NjQ0MTcsImV4cCI6MTU2MTc1MDgxN30.kbWfime8IHY0PtQJhVpkqjCjlmjvSJpV7nfQMEhaLjo",
"ID": 2,
"type": 1
}
Method Url: /api/users
HTTP method: [GET]
[
{
"id": 1,
"user_id": 2,
"username": "Charles",
"about": "I am a stylist that has in eye for detail making my cuts and color stand out more than my peers",
"skills": "cut color",
"profile_img": "https://source.unsplash.com/200x200/?hair"
},
{
"id": 2,
"user_id": 3,
"username": "Ashley",
"about": "I am a stylist that has in eye for detail making my styles stand out more than my peers",
"skills": "up-dos down-dos",
"profile_img": "https://source.unsplash.com/200x200/?hair"
},
{
"id": 3,
"user_id": 4,
"username": "Jessica",
"about": "I am an all around hair stylist great at every part of the process",
"skills": "cut color styles nails",
"profile_img": "https://source.unsplash.com/200x200/?hair"
}
]
Method Url: /api/users/all
HTTP method: [GET]
[
{
"email": "kedasha@yahoo.com",
"stylist": 0
},
{
"email": "charles@yahoo.com",
"stylist": 1
},
{
"email": "ashley@yahoo.com",
"stylist": 1
},
{
"email": "jessica@yahoo.com",
"stylist": 1
},
{
"email": "charlie@yahoo.com",
"stylist": 0
},
{
"email": "miss@yahoo.com",
"stylist": null
},
{
"email": "email@yahoo.com",
"stylist": null
},
{
"email": "ema@yahoo.com",
"stylist": null
}
]
Method Url: /api/users/:id
HTTP method: [GET]
{
"stylist": {
"id": 1,
"user_id": 2,
"username": "Charles",
"about": "I am a stylist that has in eye for detail making my cuts and color stand out more than my peers",
"skills": "cut color",
"profile_img": "https://source.unsplash.com/200x200/?hair",
"portfolio": [
{
"id": 1,
"stylists_id": 1,
"portfolio_image": "https://source.unsplash.com/400x400/?hair"
},
{
"id": 2,
"stylists_id": 1,
"portfolio_image": "https://source.unsplash.com/400x400/?hair"
},
{
"id": 3,
"stylists_id": 1,
"portfolio_image": "https://source.unsplash.com/400x400/?hair"
},
{
"id": 4,
"stylists_id": 1,
"portfolio_image": "https://source.unsplash.com/400x400/?hair"
}
],
"posts": [
{
"id": 1,
"stylists_id": 1,
"title": "My first",
"posts_image": "https://source.unsplash.com/400x400/?hair",
"description": "this is my first post and I feel really good about it"
},
{
"id": 2,
"stylists_id": 1,
"title": "My second",
"posts_image": "https://source.unsplash.com/400x400/?hair",
"description": "this is my second post and I feel really good about it"
}
]
}
}
Method Url: /api/users/:id
Protected Route | User with the stylist role Only
HTTP method: [PUT]
{
"message": "Update was Successful"
}
Method Url: /api/users/:id
Protected Route | User with the stylist role Only
HTTP method: [DELETE]
{
"message": "User account removed successfully"
}
Method Url: /api/users/posts
HTTP method: [POST]
{
"message": "Post created, congratulations!!!"
}
Method Url: /api/users/:id/posts
HTTP method: [PUT]
{
"message": "Post Successfully Updated, congratulations!!!"
}
Method Url: /api/users/:id/posts
Protected Route | User with the stylist role Only
HTTP method: [DELETE]
{
"message": "User post removed successfully"
}