After successful start of the solution in any of above option, check useful endpoints:
- weater average endpoint - http://localhost:5000/weather/weather/average
- API interactive documentation - http://localhost:5000/api-doc/
- health check - <http://localhost:5000/weather
- version - http://localhost:5000/version
Execute dotnet run --project src/HappyCode.NetCoreBoilerplate.Api in the root directory.
- Docker Hub - https://hub.docker.com/r/lkurzyniec/netcore-boilerplate
- GitHub Container Registry - https://github.com/lkurzyniec/netcore-boilerplate/pkgs/container/netcore-boilerplate
Simply execute docker run --rm -p 5000:8080 --name netcore-boilerplate lkurzyniec/netcore-boilerplate to download and spin up a container.
To run in docker with your own image, execute docker build . -t netcore-boilerplate:local in the root directory to build an image,
and then docker run --rm -p 5000:8080 --name netcore-boilerplate netcore-boilerplate:local to spin up a container with it.
When running on
Linux(i.e. WSL), make sure that all docker files (dockerfile, docker-compose and all mssql files) have line endingsLF.
Just execute docker-compose up command in the root directory.
When the entire environment is up and running, you can additionally run a migration tool to add some new schema objects into MsSQL DB.
To do that, go to src/HappyCode.NetCoreBoilerplate.Db directory and execute dotnet run command.
HappyCode.NetCoreBoilerplate.Api
- The entry point of the app - Program.cs
- Simple Startup class - Startup.cs
- Logging and Global exception middleware
- MvcCore
- DbContext (with MySQL)
- DbContext (with MsSQL)
- OpenAPI
- HostedService and HttpClient
- Core components and Books module registration
- FeatureManagement
- HealthChecks
- MySQL
- MsSQL
- Infrastructure
Bannerconfiguration place - BannerConfigurator.csSerilogconfiguration place - SerilogConfigurator.cs- Filters
- Simple
ApiKeyAuthorization filter - ApiKeyAuthorizationFilter.cs - MVC Global exception filter - HttpGlobalExceptionFilter.cs
- Simple
- Logging
- Custom enricher to have version properties in logs - VersionEnricher.cs
- Middlewares
- Simple middleware - ConnectionInfoMiddleware.cs
- Global exception handler - ExceptionMiddleware.cs
OpenAPI- Registration place - OpenApiRegistrations.cs
- Mark disabled feature as Deprecated - FeatureFlagOperationTransformer.cs
- Remove Deprecated operations - RemoveDeprecatedDocumentTransformer.cs
- Add security requirement - SecurityRequirementOperationTransformer.cs
- Simple custom middleware that logs connection info - ConnectionInfoMiddleware.cs
- Simple exemplary API controllers - WeatherController.cs, CarsController.cs, PingsController.cs
- Example of BackgroundService - PingWebsiteBackgroundService.cs
HappyCode.NetCoreBoilerplate.Core
- Models
- Dto models
- DB models
- AppSettings models - Settings
- DbContexts
- MySQL DbContext - WeatherContext.cs
- MsSQL DbContext - CarsContext.cs
- Providers
- Version provider - VersionProvider.cs
- Core registrations - CoreRegistrations.cs
- Exemplary MySQL repository - WeatherRepository.cs
- Exemplary MsSQL service - CarService.cs
HappyCode.NetCoreBoilerplate.Db
- Console application as a simple db migration tool - Program.cs
- Sample migration scripts, both
.sqland.cs- S001_AddCarTypesTable.sql, S002_ModifySomeRows.cs
HappyCode.NetCoreBoilerplate.Api.IntegrationTests
- Infrastructure
- Fixture with TestServer - TestServerClientFixture.cs
- TestStartup with InMemory databases - TestStartup.cs
- Simple data feeders - WeatherContextDataFeeder.cs, CarsContextDataFeeder.cs
- Fakes - FakePingService.cs
- Exemplary tests - WeatherTests.cs, CarsTests.cs, PingsTests.cs
HappyCode.NetCoreBoilerplate.Api.UnitTests
- Exemplary tests - WeatherControllerTests.cs, CarsControllerTests.cs, PingsControllerTests.cs
- API Infrastructure Unit tests
HappyCode.NetCoreBoilerplate.Core.UnitTests
- Extension methods to mock
DbSetfaster - EnumerableExtensions.cs - Exemplary tests - WeatherRepositoryTests.cs, CarServiceTests.cs
- Providers tests
HappyCode.NetCoreBoilerplate.ArchitecturalTests
- Exemplary tests - ApiArchitecturalTests.cs, CoreArchitecturalTests.cs
HappyCode.NetCoreBoilerplate.BooksModule.IntegrationTests
- Infrastructure
- Fixture with TestServer - TestServerClientFixture.cs
- any idea? Please create an issue.





