Skip to content

hahunavth/sp-be

 
 

Repository files navigation

Structure programming backend SP_17

Fly Deploy DeepSource DeepSource

  • Project này sử dụng framework Express js
  • Trong project có áp dụng Service Repository Pattern. Chi tiết ở phần Project structure.

Project structure:

.
├── db_migration.md
├── docker-compose.yml
├── docker-entrypoint.sh
├── Dockerfile
├── ecosystem.config.js
├── fly.toml
├── nginx.conf
├── package.json
├── .env                # File định nghĩa biến môi trường
├── dist                # Thư mục chứa file js được build từ ts
├── src
│   ├── app.ts
│   ├── config          # Chứa các file dùng để load config, env
│   ├── controllers     # Chứa các controllers
│   ├── databases       # Script kết nối DB
│   ├── dtos            # Chứa các data transfer object (dtos)
│   ├── exceptions      #
│   ├── http            #
│   ├── interfaces      #
│   ├── middlewares     # Định nghĩa các middleware
│   ├── migrations      #
│   ├── models          # Định nghĩa schema cho db
│   ├── routes          # Map các route tới controller tương ứng
│   ├── seeders         # Seed db
│   ├── server.ts       #
│   ├── services        # Business logic
│   ├── tests           # test
│   └── utils           #
└── tsconfig.json

Setup

Config .env

# PORT
PORT = 3000

# DATABASE
DB_HOST = sp-17-production-db.fly.dev
DB_PORT = 5432
DB_USER = postgres
DB_PASSWORD = lvI5yXgQkZFfkVq
DB_DATABASE = sp_17_production_v2
# DIALECT=postgres

# TOKEN
SECRET_KEY = secretKey

# LOG
LOG_FORMAT = dev
LOG_DIR = ../logs

# CORS
ORIGIN = *
CREDENTIALS = true

Install libraries

Sử dụng lệnh npm install

Run

Chạy trên môi trường development sử dụng lệnh npm dev
Chạy production dùng lệnh npm start

Hướng dẫn tester

Dựa theo link postman bên dưới, vào phần Version 1. Sửa BaseURL giống như link bên dưới để test. Sau đó đối chiếu kết quả trả về với kết quả ghi trong Link API Doc. Có thể thử các trường hợp vi phạm để bắt các lỗi không hợp lệ.

Link tài liệu

About

Project lập trình cấu trúc SP_17 (Backend)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 95.1%
  • JavaScript 3.4%
  • Other 1.5%