trulysinclair / supermarket-api

Simple RESTful API built with ASP.NET Core and .NET 8 to show how to create RESTful services using a decoupled, maintainable architecture.

Home Page:https://medium.com/free-code-camp/an-awesome-guide-on-how-to-build-restful-apis-with-asp-net-core-87b818123e28

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supermarket API

All Contributors

Simple RESTful API built with ASP.NET Core and .NET 8 to show how to create RESTful services using a decoupled, maintainable architecture.

Changes list

Many changes were made to the code presented at the tutorial published on Medium and freeCodeCamp, to make the API code cleaner and to add functionalities that developers may find useful.

If you want to download the original code showed on the tutorial, download the 1.0.0 tag.

  • 2.1.0 [February 9, 2024]

    • Updated .NET version to .NET 8.
    • Updated libraries to match the most recent .NET version.
    • Added Docker support.
    • Refactored code to use expression body methods, primary constructors, and new object and collection initialization.
    • Added required constraint to resources.
  • 2.0.0 [July 5, 2023]

    • Updated .NET version to .NET 7.
    • Updated AutoMapper, Entity Framework Core, and Swashbuckle dependencies to match .NET 7.
    • Enabled implicit usings and nullable types.
    • Added global usings and removed implicit namespaces from the source code.
    • Renamed the UnitOfMeasurement enum type to make it follow the official naming convention.
    • Removed CategoryResponse and ProductReponse types to use a generic Response<T> record type instead.
    • Changed API resources to use record types instead of classes, and to initialize values in an immutable way using init.
    • Added configuration to make all API routes lower-case.
    • Refactored services to include logging using the standar .NET logging provider and to make code cleaner.
  • 1.4.0 [November 26, 2021]

    • Updated .NET version to .NET 5 (see #11)
    • Updated AutoMapper, Entity Framework Core, and Swashbuckle dependencies to match .NET 5.
    • Created BaseApiController class to standardize routes and to automatically apply data annotations validation by using the ApiController attribute.
    • Refactored logic to seed database data and to apply entity type configuration for application models.
  • 1.3.0 [December 15, 2019]

    • Updated ASP.NET Core version to 3.1, fixed issues related to InMemoryProvider, updated Swagger (see #5).
    • Fixed paging calculation mistake, updated descriptions, updated "launchSettings.json" to open Swagger on running the application.
  • 1.2.1 [August 11, 2019]

    • Changed BaseResponse to use generics as a way to simplify responses (see #3).
  • 1.2.0 [July 15, 2019]

    • Changed /api/products endpoint to allow pagination (see #1).
  • 1.1.0 [June 18, 2019]

    • Added Swagger documentation through Swashbuckle.
    • Added cache through native IMemoryCache.
    • Changed products listing to allow filtering by category ID, to show how to perform specific queries with EF Core.
    • Changed ModelState validation to use ApiController attribute and InvalidResponseFactory in Startup.
  • 1.0.0 [February 4, 2019]

Frameworks and Libraries

How to Test

First, download and install the .NET Core SDK.

If you have Docker and Visual Studio installed on your machine, you can open the solution file using Visual Studio and run the project using the Docker profile.

If not, open the terminal or command prompt at the API root path (/src/Supermarket.API/) and run the following commands, in sequence:

dotnet restore
dotnet run

Navigate to http://localhost:5000/api/categories to check if the API is working. If you see a HTTPS security error, just add an exception to see the results.

Navigate to http://localhost:5000/swagger to check the API documentation and to test all API endpoints.

API Documentation

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Matt Barry

💻

hippie

💻

NoobInTraining

💻

Ma'hmmoud Kinawy

💻

Ahsan Raza

👀

dundich

🤔

thedon_chris

🐛

subhanisyed17

🐛

Eric Wilson

💬

Phạm Tuấn Phát

🤔

miki-nis

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Simple RESTful API built with ASP.NET Core and .NET 8 to show how to create RESTful services using a decoupled, maintainable architecture.

https://medium.com/free-code-camp/an-awesome-guide-on-how-to-build-restful-apis-with-asp-net-core-87b818123e28

License:MIT License


Languages

Language:C# 98.3%Language:Dockerfile 1.7%