Skip to content

gedsonmarcelino/api-test-to-trainee

Repository files navigation

API Rest to trainee

Requirements

  • Node
  • Yarn (recommended) ou NPM

Running application

# Installing libraries
$ yarn # or npm install

# Running appication
$ yarn start # or npm run start

Routes

Authentication

Method Path Return
POST /auth/token Object
# --- Body Request ---
{
  "username" : "string",
  "password" : "string"
}

# --- Response ---
{
  "token" : "string"
}

User

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"
}

Posts

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"
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published