Note
Template for development of back-end projects using nodejs with sequelize.
Dependencies | Version |
---|---|
sequelize | 6.37.3 |
sequelize-cli | 6.6.2 |
node | 18.0 or higher |
express | 4.19.2 |
mysql2 | 3.11.0 |
dotenv | 16.4.5 |
git clone git@github.com:antonioclp/sequelize-nodejs-template.git
cd sequelize-template
npm install
Uses docker and docker-compose. This template have a
dockerfile
anddocker-compose.yaml
.
FROM node:20-alpine
WORKDIR /app/back
COPY package*.json /app/back/
RUN npm install
COPY . .
RUN npm run build
version: "3"
services:
api:
build:
context: .
dockerfile: dockerfile
container_name: api
tty: true
stdin_open: true
command: npm run dev
restart: always
working_dir: /app/back
depends_on:
- db
ports:
- 3001:3001
env_file:
- .env
volumes:
- .:/app/back
db:
container_name: db
image: mysql:8.0.32
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: example_password
docker-compose up --build -d
docker exec -it api sh
npm run db:reset
docker system prune --volumes
Note
Uses ESLint Stylistic.
import config from '@rocketseat/eslint-config/node.mjs'
export default config
Format on save
./.vscode/settings.json
.
{
"editor.codeActionsOnSave": [
"source.fixAll.eslint"
],
"editor.formatOnSave": false,
"eslint.format.enable": true
}