A simple .net core 2.0 based project implementing REST API for monitoring service status.
- ASP.NET Core 2.0
- Web API
- VS 2017 or VS Code
- dontet core 2.0
- Clone this repo.
- Open solution file in Visual Studio 2017 or
- Open solution folder into VS Code
- At VS Code terminal windows, change directory to Api.Health project and
- run
dotnet restore
- run
dotnet run
- run
- At VS Code terminal windows, change directory to Api.Health project and
Call API using CURL
curl -X GET --header 'Accept: application/json' 'http://localhost:8363/api/health/heartbeat'
Response:
{
"heartbeat": "OK"
}
Also, you can play with API by running
Api.Web
application and loading/swagger
ui.
The Health API is available as nuget package.
Make sure that
/api/health/heartbeat
is not used in any other controller within your project.
Currently the API has been implemented as Controller so no middleware configuration is required. API will work as soon as it is referenced.
MIT