Skip to content
jorgeafc00h edited this page Apr 8, 2019 · 14 revisions

Welcome to the StoreApiC wiki!

General and simple documentation

the api should start automatically and seed database with EF core migrations and Polly library for retry and availability with resiliency approach.

Basic requirements

* Start Visual studio as administrator.

* Optional if the web api does not starts due to missing https certificate,

enable https development certificates run command > dotnet dev-certs https

* Optional if the web api does not starts try using StoreApi instead of IIS express for debugging.

Design pattern and naming convention

Description

StoreAPi is a small restful service created using solid design principles such as Separation of concerns (SoC) and dependency injection from asp.net core

Project Structure

* Building Blocks

contains libraries with common logic that can be used for other projects such as web API Extensions, models,

* Store Service

contains libraires StoreApi with the implementation for business logic, database context, IdentityServer 4 implementation all of them in a separate libraries to develop a solution with a high maintainability Index

* Tests

contains integration tests to validate the auth. logic and business logic using mock data.

Packaging approach

  • Aviod install unecessary nuget packages
  • The main goal is keep code clean at StoreApi api project by avoiding install packages directly in the project the required packages should be managed in a separate libs and inject required dependencies using asp.net core dependency injection standard

Asp.net Core web API analyzers

https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/analyzers?view=aspnetcore-2.2&tabs=visual-studio

#Identity Implementation Identity Server web api is secured with the integrated IdentityServer4 for asp.net core using dependency injection

Official Documentation https://identityserver.io/

Swagger endpint for testing

https://localhost:44373/swagger

Api Endoints

Identity

GET /api/Identity

GET /api/Identity/Adminclaims

GET /api/Identity/UserClaims

Products

GET /api/Products

POST /api/Products

GET /api/Products/{id}

DELETE /api/Products/{id}

GET /api/Products/productlog/{id}

GET /api/Products/search/{keywords}

POST /api/Products/search/{filter}

PUT /api/Products/AddStock/{productId}

PUT /api/Products/RemoveStock/{productId}

PUT /api/Products/AddSale/{productId}

DEMO ON AZURE

UNIT TEST AND POSTMAN INTEGRATION TESTS

there are in place some unit tests and integration tests in te folder for project integration tests are some collections for postman that includes environment variables in order to test the main features of the api to avoid regresions with unit testing.

in the project integration testing you can find postman collection that should contains

Collection

StoreApi Coding Test.postman_collection.json

Environments (both for local test and Azure demo api)

StoreApi.postman_environment.json

storeapi-Azure.postman_environment.json