- Node
- Yarn (recommended) ou NPM
# Installing libraries
$ yarn # or npm install
# Running appication
$ yarn start # or npm run start
Method | Path | Return |
---|---|---|
POST | /auth/token | Object |
# --- Body Request ---
{
"username" : "string",
"password" : "string"
}
# --- Response ---
{
"token" : "string"
}
Header: Authorization: Bearer {token}
Method | Path | Return | Description |
---|---|---|---|
GET | /user | Object<User> | Get data user |
# --- Response <User> ---
{
"id": "number",
"name": "string",
"username": "string",
"avatar": "string",
"createdAt": "string"
}
For more details, check the json-server documentation.
Header: Authorization: Bearer {token}
Method | Path | Return | Description |
---|---|---|---|
GET | /posts | Array<Post> | list posts |
GET | /posts/:id | Object<Post> | get by id |
POST | /posts | Object<Post> | Insert or Update posts |
DELETE | /posts/:id | Object<Post> | Delete posts |
# --- Response <Post> ---
{
"id": "number",
"title": "string",
"author": "string",
"createdAt": "string",
"comments": [
{
"id": "number",
"body": "string",
"createdAt": "string"
}
]
}