All Projects → amehat → nestjs-cqrs-saga

amehat / nestjs-cqrs-saga

Licence: MIT license
Nestjs application with CQRS pattern and SAGA

Programming Languages

typescript
32286 projects

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].