greenat92 / nestjs-cqrs-saga

Nestjs application with CQRS pattern and SAGA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

Description

Nest framework TypeScript starter repository.

Simple Nestjs application implementing CQRS principles with SAGA around a product.

The saga adds the product to the catalog (it's just an example ;) )

Installation

$ npm install

Running the app

# start docker compose
$ docker-compose up

# end docker compose
$ docker-compose down

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

REST

Create product

POST http://localhost:3000/product

Body raw (JSON):

{
	"name": "chemise",
	"sku": "f5865847-6951-467d-a1bd-bef0b970ab35",
	"price": "29",
	"currency": "euro"
}

Update Product

PUT http://localhost:3000/product/{id}

Example : http://localhost:3000/product/f5865847-6951-467d-a1bd-bef0b970ab35

Body raw (JSON):

{
	"name": "pantalon",
	"sku": "f5865847-6951-467d-a1bd-bef0b970ab35",
	"price": "43",
	"currency": "euro"
}

Delete product

DELETE http://localhost:3000/product/{id}

Example : http://localhost:3000/product/f5865847-6951-467d-a1bd-bef0b970ab35

Get all products

GET http://localhost:3000/product

Get product by sku

GET http://localhost:3000/product/{id}

Example : http://localhost:3000/product/f5865847-6951-467d-a1bd-bef0b970ab35

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

License

MIT licensed.

About

Nestjs application with CQRS pattern and SAGA

License:MIT License


Languages

Language:TypeScript 100.0%