Skip to content

bretthargreaves/BasicAPI

Repository files navigation

BasicAPI

An ASP.NET Core Web API built on .NET 10, structured for microservices development.

Project Layout

BasicAPI/
├── Controllers/        # API controllers — one per resource, route via [Route("api/[controller]")]
├── Models/             # Request/response data models and domain entities
├── Services/           # Business logic — interfaces in this folder, implementations alongside
├── Properties/         # Launch settings (ports, environment profiles)
├── appsettings.json    # Base configuration
├── appsettings.Development.json  # Development overrides
└── Program.cs          # App bootstrap: DI registration, middleware pipeline

Endpoints

Method Path Description
GET /health Health check (returns 200 Healthy)
GET /api/example List all example items
GET /api/example/{id} Get a single item by ID
POST /api/example Create a new item
DELETE /api/example/{id} Delete an item by ID
GET /openapi/v1.json OpenAPI spec (development only)

Getting Started

dotnet run

The API starts on https://localhost:5001 (or the port defined in Properties/launchSettings.json).

Adding a New Resource

  1. Model — add a class in Models/
  2. Service interface — add IYourService.cs in Services/
  3. Service implementation — add YourService.cs in Services/
  4. Register — add builder.Services.AddSingleton<IYourService, YourService>(); in Program.cs
  5. Controller — add YourController.cs in Controllers/ decorated with [ApiController] and [Route("api/[controller]")]

Health Check

GET /health is served by the ASP.NET Core health check middleware. Additional checks (database, downstream services) can be registered via builder.Services.AddHealthChecks().AddCheck(...).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages