Skip to content

Basic example of Api .net using sort of HMA arquitecture. (TODO: hexagonal arquitecture with DDD design)

Notifications You must be signed in to change notification settings

avirgili-eclub/BasicApiNet

Repository files navigation

BasicApiNet

Codacy Badge

This is a basic example of a web API built on .NET Core 8. The main goal of this API is to demonstrate basic CRUD (Create, Read, Update, Delete) operations using two main entities: Country and City.

Key Features

  • Utilizes .NET Core 8 for API development.
  • Implements dependency injection architecture for better modularity and maintainability of the code.
  • Uses a local SQLite database to persistently store data.
  • Employs Entity Framework Core as the ORM (Object-Relational Mapping) for interacting with the database.
  • A middleware has been added to handle exceptions globally, improving error management in the application.
  • Unit tests are used for repository testing.

Prerequisites

  • .NET Core 8 must be installed on your system.
  • A C# compatible development environment is required for editing and compiling the project.

Installation and Configuration

  1. Clone this repository to your local machine:
git clone https://github.com/your-username/BasicApiNet.git
  1. Navigate to the project directory:
cd BasicApiNet
  1. Open the project in your preferred development environment.
  2. Build the project using the command:
dotnet build
  1. Run the migrations to set up the SQLite database:
dotnet ef migrations add InitialCreate -p BasicApiNet.Access -s BasicApiNet.Host -o Data/Migrations
  1. Apply the migrations to create the database:
dotnet ef database update
  1. Start the application by running the command:
dotnet run

Usage

  • Once the application is running, you first have to login (admin:admin123) to generate the jwt token, copy the token to access protected endpoints.
  • Once you have the token set you can make HTTP requests via the API to perform CRUD operations on the Country and City entities.
  • Make sure to review the API documentation to learn about the available endpoints and their respective operations.

About

Basic example of Api .net using sort of HMA arquitecture. (TODO: hexagonal arquitecture with DDD design)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages