Skip to content

dannylbr/IntegrApi

Repository files navigation

IntegrApi

.NET

A clean, minimal API example implemented in C# .NET, designed as a lightweight template and learning resource.


💡 Table of Contents


About

IntegrApi is a minimalist example of a RESTful API built using the .NET minimal API style (available since .NET 6), focused on simplicity and best practices. The goal is to serve both as:

  • A boilerplate for microservices or small backend services.
  • A learning tool to understand how to set up and organize a minimal API in C#.

Minimal APIs reduce boilerplate compared to traditional controller-based ASP.NET projects, making them ideal for lightweight apps, microservices, or rapid prototyping. :contentReference[oaicite:0]{index=0}


Features

  • 🚀 Minimal setup with Program.cs as the entry point
  • 📡 Simple CRUD endpoints
  • 🔧 Configuration using appsettings.json
  • 📁 Layered architecture: Models, Properties, etc.
  • 💬 HTTP request examples using .http file
  • 🧪 Ready for further integration with testing suites or middleware

Getting Started

Prerequisites


Installation

  1. Clone the repository:

     git clone https://github.com/dannylbr/IntegrApi.git
     cd IntegrApi
  2. Restore NuGet packages:

    dotnet restore
  3. Build the project:

    dotnet build

Running the API

To run the API locally, use the following command:

   dotnet run --project IntegrApi

By default, the application will start listening on a configured port (as defined in appsettings.json, if any). You can explore the HTTP endpoints or run the .http file included in the repo to test it quickly.

API Overview

Below is a conceptual overview of the possible endpoints:

Method Route Description
GET / Return "Elegant."
GET /user/{id} Return a boilerplate User

Project Structure

IntegrApi/
│
├── Models/                   # Domain models (e.g., DTOs, business objects)
│   └── User.cs
│
├── Properties/               # Auto-generated or project metadata files
│   └── launchSettings.json
│
├── Program.cs                # Entry point: minimal API + routing + DI
│
├── appsettings.json          # Default config
├── appsettings.Development.json # Dev overrides
│
├── IntegrApi.http            # Pre-made HTTP requests (for VSCode, etc.)
│
├── IntegrApi.sln              # Solution file
│
├── .gitignore                # Git ignore rules
|
└── README.md                 # Project documentation

Configuration

  • appsettings.json: holds the configuration for the application (ports, logging, etc.).

  • appsettings.Development.json: overrides for development environment.

You can easily extend this to support secret storage, connection strings, or feature flags.

Testing & Requests

While this project does not include automated tests yet, you can:

  1. Use the IntegrApi.http file to send HTTP requests directly from VS Code (using the REST Client extension).
  2. Use tools like Postman or curl for manual testing.

Here’s a sample curl request to get "Elegant." string (change localhost:5000 to your running port):

curl -X GET http://localhost:5000/

Contributing

Contributions are very welcome! Here are a few ways you could help:

  • Add unit / integration tests
  • Implement middleware (e.g., logging, validation, authentication)
  • Provide error handling / validation
  • Add OpenAPI / Swagger integration
  • Improve documentation or expand the .http file with more example requests

Feel free to open issues or pull requests — I appreciate your help!

Contact

Thank you for checking out IntegrApi!

About

A minimal API example in C#.NET

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages