Skip to content

4lessandrodev/ddd-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDD APP

Simple App

App built using types-ddd v3 Link Here

A minimum project to test the domain driven design lib

How to run this app

  • Install deps
$ yarn install
  • Run the tests
$ yarn test
  • Run the app
$ yarn dev
  • Run integration tests
$ yarn test:e2e
  • On your terminal run commands or copy curl to execute in postman*
# List products 

$ curl http://localhost:3000/products | jq '.'
# Create Product

$ curl -X POST -H "Content-Type: application/json" \
-d '{ "name": "valid", "price": 21.00 }' \
http://localhost:3000/products | jq '.'
# Update Product

$ curl -X PUT -H "Content-Type: application/json" \
-d '{ "name": "items", "price": 42.00 }' \
http://localhost:3000/products/:id | jq '.'

# List Invoices

$ curl http://localhost:3000/invoices | jq '.'

Business Rules

When a product (Product Context) is created, an event is dispatched to the Invoice Context domain. The domain generates an invoice aggregate and validates business rules, then dispatches another event to its own context in the infrastructure to build and save the invoice.

graph LR
    A[Create Product] -->|Event| B[Invoice]
    B -->|Processing| C[Print Invoice]
Loading

About

sample app for types-ddd v3

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published