A simple API REST using ASP.NET 10, Entity Framework Core , SQLite and Testing with xUnit.
The API endpoints are available in the collections folder using Bruno for testing and documentation.
Base URL: http://localhost:5187/games
- GET /games - Get all games
- GET /games/{id} - Get game by ID
- POST /games - Create new game
{ "name": "Game Name", "genreId": 1, "price": 59.99, "releaseDate": "2023-10-20" } - PUT /games/{id} - Update existing game
- DELETE /games/{id} - Delete game by ID
Base URL: http://localhost:5187/genres
- GET /genres - Get all genres
- GET /genres/{id} - Get genre by ID
- POST /genres - Create new genre
{ "name": "Genre Name" } - PUT /genres/{id} - Update existing genre
- DELETE /genres/{id} - Delete genre by ID
collections/
├── Games/
│ ├── get all games.bru
│ ├── get id games.bru
│ ├── create game.bru
│ ├── update game id.bru
│ └── delete game id.bru
├── Genres/
│ ├── get all genres.bru
│ ├── get id genres.bru
│ ├── create genre.bru
│ ├── update genre id.bru
│ └── delete genre id.bru
└── bruno.json
dotnet new web -n <nameproject>
dotnet run
dotnet build
search packages or libraries in nuget
create migration
dotnet ef migrations add InitialCreate --output-dir Data\Migrations
update database
dotnet ef database update
in terminal put enviroment variable powershell
$env:ConnectionStrings__GameStore="Data Source=Production.db"
o use User Secrets secrets.json
dotnet user-secrets init
dotnet user-secrets set "ConnectionStrings:GameStore" "Data Source=Production.db"
Inspiration in youtube tutorial
Creation of project unit tests
dotnet new xunit -n GameStore.UnitTests
For add reference to GameStore project
dotnet add GameStore.UnitTests reference GameStore
execute all tests
dotnet test
Creation of solution of .slnx
dotnet new sln -n GameStore
ADD projects to solution
dotnet sln add GameStore
#for add unit tests project
dotnet sln add GameStore.UnitTests
This project is licensed under the MIT License - see the LICENSE file for details.
Diego Ivan Perea Montealegre
- GitHub: @diegoperea20
Created by Diego Ivan Perea Montealegre