Skip to content

ammarnajjar/amicroservice

Repository files navigation

Build Status

Simple Microservice with Webapi

To run using docker:

docker-compose up

End Points

/api/users

  • GET: returns a list of users
[
  {
    "id": 1,
    "name": "first"
  },
  {
    "id": 2,
    "name": "second"
  }
]

/api/computer

This is an example of implement builder design pattern.

  • GET: returns a list of computers
[
  {
    "cpu": "LaptopCPU",
    "mark": "",
    "gpu": "LaptopGPU",
    "ram": "16GB",
    "color": "LaptopBlack",
    "resolution": "LaptopResolution"
  },
  {
    "cpu": "SuperCPU",
    "mark": "",
    "gpu": "SuperGPU",
    "ram": "256GB",
    "color": "SuperBlack",
    "resolution": "SuperResolution"
  }
]

/api/forecast

This is an example of implement adapter design pattern.

  • GET: returns a list of temperature conversions
[
  "100 in Fahrenheit is 37.7777777777778 in Celsius",
  "0 in Celsius is 32 in Fahrenheit"
]

/api/pizza

This is an example of implement factory design pattern.

  • GET: /api/pizza to reutrn list of pizzas
  • GET: /api/pizza/{id} to reutrn pizza with id
  • POST: /api/pizza to add pizza to the list Request body:
{
	"id": 5,
	"name": "new Pizza",
	"category": "new Category"
}
  • PUT: /api/pizza/{id} to update pizza in the list Request body:
{
	"id": 5,
	"name": "modified name",
	"category": "modified category"
}
  • DELETE: /api/pizza/{id} to remove pizza with id from the list

Refer to: