Skip to content

Commit d9b4f8b

Browse files
committed
Initial commit
0 parents  commit d9b4f8b

File tree

22 files changed

+303
-0
lines changed

22 files changed

+303
-0
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Configurações globais
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.{js,jsx,ts,tsx}]
13+
indent_size = 2
14+
15+
[*.json]
16+
indent_size = 2
17+
18+
[*.md]
19+
trim_trailing_whitespace = false

.gitignore

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
*.lcov
22+
23+
# nyc test coverage
24+
.nyc_output
25+
26+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
27+
.grunt
28+
29+
# Bower dependency directory (https://bower.io/)
30+
bower_components
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (https://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directories
39+
node_modules/
40+
jspm_packages/
41+
42+
# TypeScript v1 declaration files
43+
typings/
44+
45+
# TypeScript cache
46+
*.tsbuildinfo
47+
48+
# Optional npm cache directory
49+
.npm
50+
51+
# Optional eslint cache
52+
.eslintcache
53+
54+
# Microbundle cache
55+
.rpt2_cache/
56+
.rts2_cache_cjs/
57+
.rts2_cache_es/
58+
.rts2_cache_umd/
59+
60+
# Optional REPL history
61+
.node_repl_history
62+
63+
# Output of 'npm pack'
64+
*.tgz
65+
66+
# Yarn Integrity file
67+
.yarn-integrity
68+
69+
# dotenv environment variables file
70+
.env
71+
.env.test
72+
73+
# parcel-bundler cache (https://parceljs.org/)
74+
.cache
75+
76+
# Next.js build output
77+
.next
78+
79+
# Nuxt.js build / generate output
80+
.nuxt
81+
dist
82+
83+
# Gatsby files
84+
.cache/
85+
86+
# vuepress build output
87+
.vuepress/dist
88+
89+
# Serverless directories
90+
.serverless/
91+
92+
# FuseBox cache
93+
.fusebox/
94+
95+
# DynamoDB Local files
96+
.dynamodb/
97+
98+
# TernJS port file
99+
.tern-port
100+
101+
# Editor directories and files
102+
.idea
103+
.DS_Store
104+
*.suo
105+
*.ntvs*
106+
*.njsproj
107+
*.sln
108+
*.sw?
109+
110+
# Others
111+
temp
112+
dist
113+
*.local
114+
dist-ssr
115+
package-lock.json
116+
src/database/

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"trailingComma": "es5",
5+
"printWidth": 120
6+
}

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"streetsidesoftware.code-spell-checker",
4+
"streetsidesoftware.code-spell-checker-portuguese-brazilian",
5+
"esbenp.prettier-vscode",
6+
"dbaeumer.vscode-eslint",
7+
"editorconfig.editorconfig",
8+
"mikestead.dotenv"
9+
]
10+
}

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Debug",
6+
"request": "launch",
7+
"command": "npm run dev",
8+
"cwd": "${workspaceFolder}",
9+
"type": "node-terminal"
10+
},
11+
{
12+
"name": "Run App",
13+
"request": "launch",
14+
"command": "npm start",
15+
"cwd": "${workspaceFolder}",
16+
"type": "node-terminal"
17+
}
18+
]
19+
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"cSpell.language": "en,pt,pt_BR",
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"[javascript]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[json]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
},
11+
"cSpell.words": ["tglima", "integração", "gemini", "webapi"],
12+
"cSpell.ignorePaths": ["**/logs/**", ".gitignore", ".vscode/settings.json", ".vscode/extensions.json"]
13+
}

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Utiliza a imagem do Node.js 20 no Alpine
2+
FROM node:20-alpine
3+
4+
# Pré define o valor das variáveis de ambiente utilizadas pelo
5+
# container. Caso o usuário informe será utilizado o valor
6+
# definido por ele
7+
8+
ARG NU_PORT=8000
9+
ARG NODE_ENV=production
10+
11+
# Define as variáveis de ambiente específicas para a aplicação
12+
ENV NU_PORT=$NU_PORT
13+
ENV NODE_ENV=$NODE_ENV
14+
15+
# Define o diretório de trabalho dentro do container
16+
WORKDIR /usr/src/webapi
17+
18+
# Copie os arquivos da pasta 'dist' para o diretório de trabalho
19+
COPY . /usr/src/webapi
20+
21+
# Apaga o arquivo Dockerfile
22+
RUN rm /usr/src/webapi/Dockerfile
23+
24+
#Instala o nano caso precise editar algum arquivo pelo terminal
25+
RUN apk add --no-cache nano
26+
27+
# Instala as dependências de produção
28+
RUN npm install --production
29+
30+
# Exponha a porta configurada
31+
EXPOSE $NU_PORT
32+
33+
# Comando para iniciar a aplicação
34+
CMD ["npm", "start"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 tglima
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Whitespace-only changes.

docs/collections/.gitkeep

Whitespace-only changes.

docs/database/.gitkeep

Whitespace-only changes.

docs/env/dev.env

Whitespace-only changes.

docs/scripts/.gitkeep

Whitespace-only changes.

eslint.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import globals from "globals";
2+
import pluginJs from "@eslint/js";
3+
import prettier from "eslint-config-prettier";
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
{
8+
ignores: ["dist", "node_modules", "data"],
9+
},
10+
pluginJs.configs.recommended,
11+
{
12+
languageOptions: {
13+
ecmaVersion: 2022,
14+
globals: { ...globals.node },
15+
sourceType: "module",
16+
},
17+
rules: {
18+
...prettier.rules,
19+
"no-unused-vars": "warn",
20+
"no-console": "off",
21+
indent: ["error", 2],
22+
quotes: ["error", "double"],
23+
semi: ["error", "always"],
24+
},
25+
},
26+
prettier,
27+
];

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "webapi",
3+
"version": "0.1.0",
4+
"description": "API em nodejs",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {
8+
"start": "node index.js",
9+
"dev": "nodemon ./src/index.js",
10+
"lint": "eslint .",
11+
"build": "node ./docs/scripts/build.js"
12+
},
13+
"author": "tglima",
14+
"license": "MIT",
15+
"devDependencies": {
16+
"@eslint/js": "^9.19.0",
17+
"eslint": "^9.19.0",
18+
"eslint-config-prettier": "^10.0.1",
19+
"eslint-plugin-prettier": "^5.2.3",
20+
"globals": "^15.14.0",
21+
"nodemon": "^3.1.9",
22+
"prettier": "^3.4.2"
23+
},
24+
"dependencies": {
25+
"body-parser": "^1.20.3",
26+
"cors": "^2.8.5",
27+
"dotenv": "^16.4.7",
28+
"express": "^4.21.2",
29+
"express-async-errors": "^3.1.1",
30+
"express-rate-limit": "^7.5.0",
31+
"helmet": "^8.0.0",
32+
"morgan-body": "^2.6.9",
33+
"sequelize": "^6.37.5",
34+
"sqlite3": "^5.1.7",
35+
"winston": "^3.17.0",
36+
"winston-daily-rotate-file": "^5.0.0"
37+
}
38+
}

src/config/.gitkeep

Whitespace-only changes.

src/controllers/.gitkeep

Whitespace-only changes.

src/index.js

Whitespace-only changes.

src/repositories/.gitkeep

Whitespace-only changes.

src/routes/.gitkeep

Whitespace-only changes.

src/services/.gitkeep

Whitespace-only changes.

src/utils/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)