Este repositório contém uma simples API para o desafio de front-end do BossaBox.
Tecnologias:
Faça o clone/download deste repositório, execute yarn install
. Logo em seguida você pode executar a API como desenvolvedor pelo comando yarn dev
tendo acesso aos logs, ou mesmo como prod pelo comando yarn start
. A API fica localizada em http://localhost:3000
.
Crie um arquivo .env na raiz do seu projeto com as seguintes variáveis de ambiente:
APP_URL=http://localhost:3000
MONGO_URL= *Sua URL do MongoDB*
Esta API contém as seguintes rotas:
GET /tools
: lista as ferramentas cadastradasGET /tools?tag=
: filtra as ferramentas utilizando uma busca por tagPOST /tools
: cria uma nova ferramentaDELETE /tools/:id
: apaga a ferramenta com ID :id
Requisição:
GET /tools
Resposta:
[
{
id: 1,
title: "Notion",
link: "https://notion.so",
description: "All in one tool to organize teams and ideas. Write, plan, collaborate, and get organized. ",
tags: [
"organization",
"planning",
"collaboration",
"writing",
"calendar"
]
},
{
id: 2,
title: "json-server",
link: "https://github.com/typicode/json-server",
description: "Fake REST API based on a json schema. Useful for mocking and creating APIs for front-end devs to consume in coding challenges.",
tags: [
"api",
"json",
"schema",
"node",
"github",
"rest"
]
},
{
id: 3,
title: "fastify",
link: "https://www.fastify.io/",
description: "Extremely fast and simple, low-overhead web framework for NodeJS. Supports HTTP2.",
tags: [
"web",
"framework",
"node",
"http2",
"https",
"localhost"
]
}
]
Requisição:
GET /tools?tag=node
Resposta:
[
{
id: 2,
title: "json-server",
link: "https://github.com/typicode/json-server",
description: "Fake REST API based on a json schema. Useful for mocking and creating APIs for front-end devs to consume in coding challenges.",
tags: [
"api",
"json",
"schema",
"node",
"github",
"rest"
]
},
{
id: 3,
title: "fastify",
link: "https://www.fastify.io/",
description: "Extremely fast and simple, low-overhead web framework for NodeJS. Supports HTTP2.",
tags: [
"web",
"framework",
"node",
"http2",
"https",
"localhost"
]
}
]
Requisição:
// POST /tools
// Content-Type: application/json
{
"title": "hotel",
"link": "https://github.com/typicode/hotel",
"description": "Local app manager. Start apps within your browser, developer tool with local .localhost domain and https out of the box.",
"tags":["node", "organizing", "webapps", "domain", "developer", "https", "proxy"]
}
Resposta:
{
"title": "hotel",
"link": "https://github.com/typicode/hotel",
"description": "Local app manager. Start apps within your browser, developer tool with local .localhost domain and https out of the box.",
"tags":["node", "organizing", "webapps", "domain", "developer", "https", "proxy"],
"id":5
}
Requisição:
DELETE /tools/5
Resposta:
// Status: 200 OK
{}