Skip to content

Commit 799c0c3

Browse files
authored
Merge pull request #9 from mugarate12/develop
Develop / Swagger
2 parents 6aee305 + 9721ecb commit 799c0c3

8 files changed

Lines changed: 151 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.2.7] - 2022-10-26
10+
### Added
11+
- Add swagger to documentation application
12+
913
## [1.2.6] - 2022-10-26
1014
### Added
1115
- Add pino and pino-pretty to log to console

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Basic Configuration to Nodejs With Express and Typescript
22

3-
> this module serving a basic structure and configuration of nodejs API with express and typescript
3+
> This module serving a basic structure and configuration of nodejs API with express and typescript
44
55
## Summary
66

@@ -52,6 +52,8 @@ project
5252
│ nginx
5353
| │ default.conf
5454
| │ Dockerfile
55+
│ docs
56+
| │ docs.yaml
5557
│ __tests__
5658
│ └───unit
5759
| │ | example.test.ts
@@ -145,6 +147,10 @@ npm run docker:test:build
145147

146148
- [ ] Explain how design patters used in your initial configuration of project
147149
- [ ] Explain how to use your initial configuration of project
148-
- [x] Add option to use Redis as cache
149150
- [x] Add options to get initial Dockerfile and docker-compose.yml to run your project in docker
150-
- [ ] Add options to get initial configuration to run your project in Kubernetes
151+
- [x] Use Redis as cache
152+
- [x] Use pm2 to run your project in production mode
153+
- [x] Use Nginx as reverse proxy
154+
- [x] Use Swagger to document your API
155+
156+
👔 [Linkedin](https://www.linkedin.com/in/mateus-cardoso-dos-santos-19a68a181/)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "basic-node-ts-config",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "Configuração básica para um ambiente de desenvolvimento com NodeJs + TypeScript",
55
"main": "./lib/copyFile.js",
66
"preferGlobal": true,

project/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ project
123123
│ nginx
124124
| │ default.conf
125125
| │ Dockerfile
126+
│ docs
127+
| │ docs.yaml
126128
└───src
127129
| | app.ts
128130
| | server.ts

project/docs/docs.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
openapi: 3.0.0
2+
info:
3+
description: "This is a example of documentation to your API"
4+
version: 1.2.7
5+
title: Basic Code Ts Config
6+
termsOfService: http://swagger.io/terms/
7+
contact:
8+
name: "Mateus Cardoso dos Santos"
9+
email: serjumano17@gmail.com
10+
tags:
11+
- name: example
12+
description: Something
13+
externalDocs:
14+
description: Find out more
15+
url: http://swagger.io
16+
17+
paths:
18+
/:
19+
get:
20+
tags:
21+
- example
22+
summary: "Example to route docs"
23+
description: "name value can be use your name to return message"
24+
operationId: baseRoute
25+
parameters:
26+
- name: name
27+
in: query
28+
required: false
29+
schema:
30+
type: string
31+
example: "Mateus"
32+
responses:
33+
"200":
34+
description: "Successful request"
35+
content:
36+
application/json:
37+
schema:
38+
type: object
39+
properties:
40+
message:
41+
type: string
42+
example: "API está funcionando!"
43+
44+
45+
externalDocs:
46+
description: Find out more about Swagger
47+
url: http://swagger.io
48+

project/package-lock.json

Lines changed: 75 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"pino": "^8.7.0",
3939
"pino-pretty": "^9.1.1",
4040
"redis": "^4.3.1",
41-
"run-script-os": "^1.1.6"
41+
"run-script-os": "^1.1.6",
42+
"swagger-ui-express": "^4.5.0",
43+
"yamljs": "^0.3.0"
4244
},
4345
"devDependencies": {
4446
"@babel/preset-env": "^7.19.1",
@@ -50,6 +52,7 @@
5052
"@types/jsonwebtoken": "^8.5.9",
5153
"@types/node": "^18.7.14",
5254
"@types/supertest": "^2.0.12",
55+
"@types/yamljs": "^0.2.31",
5356
"jest": "^29.0.3",
5457
"nodemon": "^2.0.19",
5558
"supertest": "^6.2.4",

0 commit comments

Comments
 (0)