Skip to content

Latest commit

 

History

History
78 lines (69 loc) · 2.61 KB

File metadata and controls

78 lines (69 loc) · 2.61 KB

API-POC Members

Architecture

SOLID Singleton architecture with 3 layers / MCM / Monolitic

Structure files

📦api-poc
┣ 📂src
┃ ┣ 📂middlewares
┃ ┃ ┣ 📜apikey.middleware.ts
┃ ┃ ┗ 📜authentication.middleware.ts
┃ ┣ 📂modules
┃ ┃ ┗ 📂v1
┃ ┃ ┃ ┣ 📂controllers
┃ ┃ ┃ ┃ ┗ 📜member.controller.ts
┃ ┃ ┃ ┣ 📂interfaces
┃ ┃ ┃ ┃ ┗ 📜request.interface.ts
┃ ┃ ┃ ┣ 📂middlewares
┃ ┃ ┃ ┃ ┗ 📜member.middleware.ts
┃ ┃ ┃ ┣ 📂models
┃ ┃ ┃ ┃ ┗ 📜member.model.ts
┃ ┃ ┃ ┣ 📂routes
┃ ┃ ┃ ┃ ┗ 📜member.route.ts
┃ ┃ ┃ ┣ 📂test
┃ ┃ ┃ ┃ ┣ member.spec.ts
┃ ┃ ┃ ┗ 📂schemas
┃ ┃ ┃ ┃ ┣ 📜login.schema.ts
┃ ┃ ┃ ┃ ┗ 📜member.schema.ts
┃ ┣ 📂services
┃ ┃ ┣ 📜jwt.service.ts
┃ ┃ ┣ 📜response-handler.service.ts
┃ ┃ ┣ 📜mongoose.service.ts
┃ ┃ ┣ 📜validator.service.ts
┃ ┃ ┗ 📜winston.service.ts
┃ ┣ 📂utils
┃ ┗ 📜app.ts
┣ 📜.env
┣ 📜.gitignore
┣ 📜README.md
┣ 📜index.ts
┣ 📜nodemon.json
┣ 📜package-lock.json
┣ 📜package.json
┗ 📜tsconfig.json

Requirements

NodeJS Version: 14.17.3
NPM Version: 6.14.13
MongoDB Version: 5.0.6

Steps

  1. Install NodeJS and MongoDB Server
  2. Set enviroment variables configuration
    • ./.env
  3. Install dependencies
    • npm install
  4. Run project
    • npm run dev (This command automatically CREATES the necessary COLLECTIONS into DATABASE) this mode is developer mode if you need to run in production mode please check section "Build and run in JavaScript"

Admin Credentials

email: root@admin.com
passw: admin123

Build and run in JavaScript

  • Transform TypeScript to JavaScript with: npm run build this will create a folder ./dist with project in JavaScript
  • Run project in JavaScript with npm start

Unit Test

Run unit test:
- start test: npm run test
- generate coverage report: npm run test-report
You can find the coverage report at ./coverage once generated

Notes:

  • This is a base structure project and continue in development.
  • This effort took about 22 Hours.
  • Unit Tests are in progress but someones are ready!.