Giter Club home page Giter Club logo

haskell-ddd-order-taking's Introduction

haskell-ddd-order-taking

build

About

This repository is Haskell implementation of the "Domain Modeling Made Functional" book.
(in the book, sample codes are written in F#).

The "place order" workflow in the book is implemented.

Run application

start server

run stack run start to start an API server at localhost:3000.

send requests

you can send POST requests to /orders endpoint.
request body contains "unvalidated order", and response body contains "place order events."

via Postman

you can use Postman to send requests using out-of-the-box request templates.
import the request collection file (test-postman/collection.json) and the environment variables file (test-postman/variables.json) to Postman.

via curl

example request is the following.

curl --location --request POST 'http://localhost:3000/orders' \
--header 'Content-Type: application/json' \
--data-raw '{
    "orderId": "test-order-id",
    "customerInfo": {
        "firstName": "test-first-name",
        "lastName": "test-last-name",
        "emailAddress": "[email protected]"
    },
    "shippingAddress": {
        "addressLine1": "test shipping street 1",
        "addressLine2": "test shipping street 2",
        "addressLine3": "test shipping street 3",
        "addressLine4": "test shipping street 4",
        "city": "test shipping city",
        "zipCode": "12345"
    },
    "billingAddress": {
        "addressLine1": "test billing street",
        "addressLine2": "",
        "addressLine3": "",
        "addressLine4": "",
        "city": "test billing city",
        "zipCode": "54321"
    },
    "orderLines": [
        {
            "orderLineId": "test-order-line-id1",
            "productCode": "W1234",
            "quantity": 1
        },
        {
            "orderLineId": "test-order-line-id2",
            "productCode": "G123",
            "quantity": 1.25
        }
    ]
}'

Automated test using hspec and sensei

run stack test to run all tests.

run stack exec sensei test/Spec.hs to run all tests on any modifications to the codes.

References

I referred to the following repositories and websites during development.

haskell-ddd-order-taking's People

Contributors

nakaakist avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.