项目作者: fkhoda

项目描述 :
Checkout Shopping List API
高级语言: C#
项目地址: git://github.com/fkhoda/checkout-shoppinglist-api.git
创建时间: 2017-05-15T06:12:56Z
项目社区:https://github.com/fkhoda/checkout-shoppinglist-api

开源协议:

下载


Checkout Shopping List API

Tooling

Required

  • ASP.NET Core 2.0

Optional

  • Docker - Tested on Docker client 17.04.0-ce, Docker server 17.05.0-ce, Docker Machine 0.10.0 and Docker Compose 1.12.0
  • Kubernetes - Tested on Kubernetes v1.7.0, kubectl v1.7.0 and Minikube v0.21.0

Note that you may need to increase your VM memory limit to 4GB or higher.

Build

  1. $ ./build.ps1

Run

  1. $ ./run.ps1

Test

  1. $ ./tests.ps1

Docker

Build Image

  1. $ dotnet restore
  2. $ dotnet publish -o build -c Release
  3. $ docker build -t fkhoda/checkout-shoppinglist-api .

Run with Docker Compose

With ELK monitoring:

  1. $ docker-compose -f docker-compose-with-monitoring.yml up

Without ELK monitoring:

  1. $ docker-compose up

Access

Kubernetes

Push Docker Image to Registry

  1. $ docker push fkhoda/checkout-shoppinglist-api

Deploy to Minikube Cluster

Deploy ELK for monitoring (Optional)

  1. $ git clone https://github.com/fkhoda/elk-kubernetes.git
  2. $ cd elk-kubernetes
  3. $ kubectl create -f .\kubefiles\ -R --namespace=default

Deploy Shopping List API with ELK monitoring

  1. $ kubectl create -f ./kubefiles/sl-deployment-with-monitoring.yaml --namespace=default
  2. $ kubectl create -f ./kubefiles/sl-service.yaml --namespace=default

Deploy Shopping List API without ELK monitoring

  1. $ kubectl create -f ./kubefiles/sl-deployment.yaml --namespace=default
  2. $ kubectl create -f ./kubefiles/sl-service.yaml --namespace=default

Access

Architecture

  • Onion Architecture



  • Actor Model with in-memory Event Sourcing and Snapshotting using Proto Actor (http://proto.actor)

Feature Highlights

Endpoints

Add Item

Method: POST

URI: /api/shoppingLists/{customerId}/items

Get All Items

Method: GET

URI: /api/shoppingLists/{customerId}/items[?pageNumber=1&pageSize=10]

Get Item

Method: GET

URI: /api/shoppingLists/{customerId}/items/{itemName}

Update Quantity

Method: PUT

URI: api/shoppingLists/{customerId}/items/{itemName}

Delete Item

Method: DELETE

URI: api/shoppingLists/{customerId}/items/{itemName}

Notes

  • Some Unit Tests are implemented in the Client Library (https://github.com/fkhoda/checkout-net-library)
  • The Authentication middleware checks for clients’ Authorization request header against this value: sk_test_32b9cb39-1cd6-4f86-b750-7069a133667d. You may have to specify it manually if you are not using the client library or its Unit Tests.