An event sourcing/CQRS POC using systemic
Start the service by doing
npm install
npm run docker
npm run start
You will need Docker running in your machine.
If you then go to http://localhost:4000/api-docs
you should see a swagger UI showing the available endpoints.
You can test the two available APIs with the following HTTP requests:
Create a book
curl -X POST -H "Content-Type: application/json" -d '{"title":"Event sourcing & CQRS", "author": { "id": "1", "name": "Felipe Polo" }, "id": "1"}' http://localhost:4000/api/v1/books
Update a book multiple times
curl -X PUT -H "Content-Type: application/json" -d '{"title":"Event sourcing & CQRS", "author": { "id": "1", "name": "Felipe Polo" }, "id": "1"}' http://localhost:4000/api/v1/books/1
curl -X PUT -H "Content-Type: application/json" -d '{"title":"Event sourcing & CQRS", "author": { "id": "1", "name": "Felipe Polo" }, "location": "Madrid", "id": "1"}' http://localhost:4000/api/v1/books/1
curl -X PUT -H "Content-Type: application/json" -d '{"title":"Event sourcing & CQRS", "author": { "id": "1", "name": "Felipe Polo" }, "location": "Caceres", "id": "1"}' http://localhost:4000/api/v1/books/1
Reindex all book commands
curl -X POST http://localhost:4000/api/v1/books/reindex
Get a book
curl -X GET http://localhost:4000/api/v1/books/1
Create a paragraph on a book
curl -X POST -H "Content-Type: application/json" -d '{"title":"My paragraph", "text": "bla bla bla"}' http://localhost:4000/api/v1/books/1/paragraphs
Get an author
curl -X GET http://localhost:4000/api/v1/authors/1