https://buildweek30before30.herokuapp.com/api
You must create an instance of axios with axios.create and have the withCredentials configuration property set to true.
const api = axios.create({
baseURL: 'https://buildweek30before30.herokuapp.com/api',
withCredentials: true,
});
api.post('/auth/register', { username: 'goodusername', password: 'goodpassword' })
.then(response => console.log(response.data))| Endpoint | Method | Notes |
|---|---|---|
| /auth/register | POST | Expects { username, password }.
|
| /auth/login | POST | In your axios' post call, add a 3rd parameter, which is an object that contains an auth object. That auth object should contain username and password.
|
| /auth/logout | GET |
|
{
"id": 9,
"user_id": 1,
"name": "Cool list",
"description": "Do it before you die",
"deadline": null,
"is_private": true,
"created_by": "test",
"comments": [
{
"id": 3,
"user_id": 1,
"content": "Hello worlasdasdd!",
"created_by": "test",
"created_at": "2019-10-22T21:29:01.718Z",
"updated_at": "2019-10-22T21:29:01.718Z"
}
],
"items": [
{
"id": 2,
"list_id": 9,
"name": "Test item",
"description": "Test description",
"deadline": null,
"completed": false
}
]
}{
"id": 3,
"list_id": 9,
"name": "Test item",
"description": "Test description",
"deadline": null,
"completed": false
}{
"id": 3,
"user_id": 1,
"content": "Hello worlasdasdd!",
"created_by": "test",
"created_at": "2019-10-22T21:29:01.718Z",
"updated_at": "2019-10-22T21:29:01.718Z"
}| Endpoint | Method | Notes |
|---|---|---|
| /lists | GET |
|
| /lists | POST |
|
| /lists/:id | PUT |
|
| /lists/:id | GET |
|
| /lists/:id | DELETE |
|
| /lists/:id/items | POST | Expects { name, description, completed, deadline (optional) }.
|
| /lists/items/:itemId | DELETE |
|
| /lists/items/:itemId | PUT | Expects { name, description, completed, deadline (optional) }.
|
| /lists/:id/comments | POST | Expects { content }.
|
| /lists/comments/:commentId | DELETE |
|
| /lists/comments/:commentId | PUT | Expects { content }.
|