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\Migrationsupdate 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 testCreation 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.UnitTestsThis 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