O projeto consiste em uma simulação de um sistema de blog, onde pode criar posts, atribuir categorias aos posts e criar usuarios.
O projeto faz uso de Typescript, NodeJS, Express. Utilizando Jest para testes unitarios
Tendo o NodeJS instalado em sua maquina, basta seguir os passos de execução utilizando seu gerenciador de pacotes preferido como NPM ou Yarn:
# Instalar todas as dependências necessárias
yarn install
# Gerar tabelas no banco de dados
yarn typeorm migration:run
# Executar projeto
yarn dev:server
POST /api/v1/users
POST /api/v1/posts
GET /api/v1/posts
GET /api/v1/posts/:id
PUT /api/v1/posts/:id
DELETE /api/v1/posts/:id
POST /api/v1/posts/categories
POST /api/v1/categories
name: string
email: string
{
"id": "f6887bb3-b476-404b-9faf-4d3d4d858b59",
"name": "JohnDoe",
"email": "johndoe@example.com",
"createdAt": "2021-12-20T17:26:05.562Z",
"updatedAt": "2021-12-20T17:26:05.562Z"
}
title: string
description: string
authorId: string
{
"id": "4863dcbb-e08d-488a-89af-e67e2ea8b07c",
"title": "New post",
"description": "Muito bom",
"authorId": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"createdAt": "2021-12-20T06:09:07.210Z",
"updatedAt": "2021-12-20T06:09:07.210Z"
}
{
[
{
"id": "f3695d24-ceec-45ce-9c27-2b0462c0fcce",
"title": "New post",
"description": "Muito bom",
"authorId": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"createdAt": "2021-12-20T06:08:47.067Z",
"updatedAt": "2021-12-20T06:08:47.067Z"
},
{
"id": "3ca22d39-ca3a-4d29-ba62-1a0d6a896093",
"title": "New post 2",
"description": "Muito bom",
"authorId": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"createdAt": "2021-12-20T06:08:48.299Z",
"updatedAt": "2021-12-20T06:08:48.299Z"
},
]
}
{
"id": "3ca22d39-ca3a-4d29-ba62-1a0d6a896093",
"title": "New post",
"description": "Muito bom",
"createdAt": "2021-12-20T06:08:48.299Z",
"updatedAt": "2021-12-20T06:08:48.299Z",
"author": {
"id": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"name": "Mathues",
"email": "matheussm@gmail.com",
"createdAt": "2021-12-20T06:08:44.372Z",
"updatedAt": "2021-12-20T06:08:44.372Z"
},
"categories": []
}
title: string
description: string
{
"id": "3ca22d39-ca3a-4d29-ba62-1a0d6a896093",
"title": "New post",
"description": "Muito bom",
"createdAt": "2021-12-20T06:08:48.299Z",
"updatedAt": "2021-12-20T06:08:48.299Z",
"author": {
"id": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"name": "John Doe",
"email": "johndoe@example.com",
"createdAt": "2021-12-20T06:08:44.372Z",
"updatedAt": "2021-12-20T06:08:44.372Z"
},
"categories": []
}
Recebe https status 204
postId: string
categoryIds: [string]
{
"id": "3ca22d39-ca3a-4d29-ba62-1a0d6a896093",
"title": "New post",
"description": "Muito bom",
"createdAt": "2021-12-20T06:08:48.299Z",
"updatedAt": "2021-12-20T06:08:48.299Z",
"authorId": "acfd0b74-8779-4174-9e58-4be3f346ea4b",
"categories": [
{
"id": "7bca25f2-0213-44cc-b4f9-d0496e5801c2",
"name": "Educação",
"created_at": "2021-12-20T06:19:56.802Z"
},
{
"id": "688627b4-19fb-4236-ab89-2248b88e0cd3",
"name": "Cultura",
"created_at": "2021-12-20T12:51:34.186Z"
}
]
}
name: string
{
"id": "688627b4-19fb-4236-ab89-2248b88e0cd3",
"name": "Cultura",
"created_at": "2021-12-20T12:51:34.186Z"
}