this is NodeJs Rest API with postgres
as primary database, in this repo express framework used to build the Rest API. and sequelize is used to build database model and migration.
- Rest API
- Messaging using Kafka
- Combine producer and consumer as one App
- Combine postgres and mongodb as one App (postgres as primary database and mongodb for receive event data from kafka)
sequenceDiagram
User->>API: hit API create note
API->>Postgres: save note
API->>Kafka: prduce event
Kafka->>MongoDB: save note
Postgres-->>API: response succes/failed
alt succes save mongo
Kafka-->>API: Commit event
else failed save mongo
Kafka-->>API: Un Commit event
end
API-->>User:response message
- npm init
- npm add -D typescript ts-node @types/node @types/express nodemon
- ./node_modules/.bin/tsc --init
- "outDir": "./build"
- add script tsc :dev "tsc && nodemon ./build/index.js"
- npm install
- npm run tsc:dev