/node-commander-pattern

Command Pattern in Node.js write by TypeScript and Inversify.js

Primary LanguageTypeScript

node-commander-pattern

Node Commander Pattern

It's a todo practice for implementing a command pattern in Node.js by TypeScript and Inversify.js

Project Structure

root
│
└───src
│   │   app.ts (main entry point)
│   │   inversify.config.ts (Config for Inversify)
│   │
│   └───api (API routes and handler, group by resource)
|   |   └───XXX
│   │        │   handler.ts
│   │        │   route.ts
│   |
│   └───commandHandler (Command handler, group by resource)
|   |   └───XXX
│   │        │   query.ts
│   │        
│   └───commands (Command, group by resource)
|   |   └───XXX
│   │        │   query.ts
│   │        
│   └───domains (Domain Functions)
│   │
│   └───entities (Entity)
│   │   
│   └───interfaces (Interface definition)
|   |   └───api
|   |   └───commandHandler
|   |   └───repository
│   │
│   └───repository (Repository)           
└───dist

Getting Started

Start Service

$ git clone https://github.com/AllenFang/node-commander-pattern.git
$ cd node-commander-pattern
$ yarn install
$ docker-compose build
$ docker-compose up -d

Stop Service

$ docker-compose stop

Remove Docker Container

This will clean all the container!

$ docker-compose down

Launch to workspace container

$ docker-compose run workspace sh

Postgres Admin

Go to http://localhost:8080

  • DataBase System: PostgreSQL
  • Server: postgres
  • User: postgres
  • Password: 123456
  • DataBase: postgres

APIs

You can check all the routes from src/api/**/routes.ts

User

Todo List

Todo Item

Todos

  • Tests
  • Finish todo basic logic
  • Implement Complex Logic
  • Production
  • Enhance Dev env
  • Integrate typeorm