Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Simple API REST ASP.NET 10

A simple API REST using ASP.NET 10, Entity Framework Core , SQLite and Testing with xUnit.

API Endpoints (Bruno Collections)

The API endpoints are available in the collections folder using Bruno for testing and documentation.

๐ŸŽฎ Games Endpoints

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

๐ŸŽญ Genres Endpoints

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

๐Ÿ“ Bruno Collection Structure

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

Creation of project

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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author / Autor

Diego Ivan Perea Montealegre


Created by Diego Ivan Perea Montealegre

About

A simple API REST using ASP.NET 10, Entity Framework Core , SQLite and Testing with xUnit.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /