JoachimL / happypathapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Happy Path API - Thin controllers and separated concerns

This repo contains an infinitely small API which demonstrates the usage of mediatr and exception handling middleware in a .net core API

The controller is kept as thin as possible, and uses Mediatr as a layer of abstraction between MVC and the business layer. No error handling is done in the controller itself. It is oblivious to anything but the happy path, so any errors thrown in the business layer bubble up to the error handling middleware, which translates known Exception types to appropriate 4xx/5xx responses.

To see how the exception handler works, start the solution ("dotnet run" in the project directory) and visit

About

License:MIT License


Languages

Language:C# 87.4%Language:Smarty 7.4%Language:Dockerfile 5.2%