Skip to content

Dockerised Scaffold .NET Core WebApi with HATEOAS, Versioning & Swagger, that contains Cake Build Scripts, Kubernetes Deployment yml

Notifications You must be signed in to change notification settings

boranx/dotnetcore-cake-docker-kubernetes

Repository files navigation

Dotnet Core WebApi with HATEOAS, Versioning & Swagger, that contains Cake Build Scripts & Kubernetes Deployment ymls

The full stack .NET Core Web API project which contains

Infrastructure:
  • Cross platform build scripts (Cake) - No additional installations needed
  • Docker support
  • Kubernetes yml files
Architecture:
  • HATEOAS
  • API Versioning
  • Swagger UI
  • A controller which is dealing with FoodItems. You can GET/POST/PUT/PATCH and DELETE them.

Dependencies

Windows:

Nothing

OSX/Linux

mono == 5.8.0 libunwind8 == 1.1-4.1

Build & Artifacts

  • If you are using windows,
build.ps1
  • If you are using linux,
./build.sh
  • You can just take a look at build.cake to see whats going on.

Docker

docker build . # Create an image using artifacts
docker run -d -p 80:80 yourimageid # Provision & run the container
  • OR Instant Run:
docker run -d -p 80:80 boranx/dotnetcorekubernetes

Browse : http://localhost/swagger/#/

Kubernetes

kubectl apply -f kubernetes/aspnetcore-rest-api-pod.yaml # Deploy the pod
kubectl apply -f kubernetes/aspnetcore-rest-api-ks.yaml # Define services

Example API Calls

Versions

http://localhost:80/swagger

ASPNETCOREWebAPIVersions

GET all Foods

http://localhost:80/api/v1/foods

ASPNETCOREWebAPIGET

GET single food

http://localhost:80/api/v1/foods/2

ASPNETCOREWebAPIGET

POST a foodItem

http://localhost:80/api/v1/foods

  {
      "name": "Lasagne",
      "type": "Main",
      "calories": 3000,
      "created": "2017-09-16T17:50:08.1510899+02:00"
  }

ASPNETCOREWebAPIGET

PUT a foodItem

http://localhost:80/api/v1/foods/5

  {
    "name": "Lasagne2",
    "type": "Main",
    "calories": 3000,
    "created": "2017-09-16T17:50:08.1510899+02:00"
  }

ASPNETCOREWebAPIGET

PATCH a foodItem

http://localhost:80/api/v1/foods/5

  [
    { "op": "replace", "path": "/name", "value": "mynewname" }
  ]

ASPNETCOREWebAPIGET

DELETE a foodItem

http://localhost:80/api/v1/foods/5

ASPNETCOREWebAPIGET

About

Dockerised Scaffold .NET Core WebApi with HATEOAS, Versioning & Swagger, that contains Cake Build Scripts, Kubernetes Deployment yml

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published