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 buildsearch packages or libraries in nuget
create migration
dotnet ef migrations add InitialCreate --output-dir Data\Migrationsupdate database
dotnet ef database updatein 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.UnitTestsFor add reference to GameStore project
dotnet add GameStore.UnitTests reference GameStoreexecute all tests
dotnet testCreation of solution of .slnx
dotnet new sln -n GameStoreADD 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