@manhng

Welcome to my blog!

Asp.Net Core Web Api

January 31, 2021 09:46

Asp.Net Core Web Api (edit)

https://www.talkingdotnet.com/clean-way-to-add-swagger-asp-net-core-application/

https://www.talkingdotnet.com/create-petstore-like-swagger-ui-asp-net-core-web-api/

https://www.talkingdotnet.com/add-swagger-to-asp-net-core-2-0-web-api/

https://www.talkingdotnet.com/support-multiple-versions-of-asp-net-core-web-api/

https://stackoverflow.com/questions/38784537/use-jwt-authorization-bearer-in-swagger-in-asp-net-core/47709074#47709074

https://petstore.swagger.io/

https://exceptionnotfound.net/setting-aspnetcore_environment-using-a-web-config-file/

C# is the best

https://github.com/exceptionnotfound/CSharpInSimpleTerms

This series is also available as a PDF; you can download it from here.

As always, pull requests are welcome!

  1. Introduction
  2. The Type System
  3. Primitive Types, Literals, and Nullables
  4. Casting, Conversion, and Parsing
  5. Operators
  6. Code Blocks, Basic Statements, and Loops
  7. Methods, Parameters, and Arguments
  8. Classes and Members
  9. Structs and Enums
  10. Inheritance and Polymorphism
  11. Interfaces and Abstract Classes
  12. Namespaces
  13. Exceptions and Exception Handling
  14. Arrays and Collections
  15. LINQ Basics
  16. Generics
  17. Tuples and Anonymous Types
  18. Attributes and Reflection
  19. Expressions, Lambdas, and Delegates
  20. String Manipulation and Cultures
  21. Dates and Times
  22. Indexers
  23. Iterators

Logging

https://www.exceptionnotfound.net/using-middleware-to-log-requests-and-responses-in-asp-net-core/

Rest Libraries

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.

https://github.com/reactiveui/refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.

new JsonSerializerSettings {
                ContractResolver = new SnakeCasePropertyNamesContractResolver() ...
new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver() ...

Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit

https://github.com/canton7/RestEase/

Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit

Swagger UI (OpenApi) with Authorization code flow + PKCE using Swashbuckle ASP.NET Core

https://lurumad.github.io/swagger-ui-with-pkce-using-swashbuckle-asp-net-core/ (HAY HAY HAY)

ASP.NET Core Swagger UI Authorization using IdentityServer4

https://www.scottbrady91.com/Identity-Server/ASPNET-Core-Swagger-UI-Authorization-using-IdentityServer4/ (HAY HAY HAY)

SECURING AN ASP.NET CORE API WHICH USES MULTIPLE ACCESS TOKENS

https://damienbod.com/2020/12/03/securing-an-asp-net-core-api-which-uses-multiple-access-tokens/ (HAY HAY HAY)

A sample for using Swashbuckle Swagger v5.5.1 with Jwt Token support

https://github.com/capcom923/MySwashBuckleSwaggerWithJwtToken (HAY HAY HAY)

https://www.talkingdotnet.com/define-a-custom-environment-in-asp-net-core/

    public const string QAEnvironment = "QA";
    public const string UATEnvironment = "UAT";
    public const string TestEnvironment = "Test"

TechMindFactory.com

Microsoft Azure AD + ASP.NET Core Web API

https://joonasw.net/

https://pradeeploganathan.com/

TechMindFactory.com

Sample ASP.NET Core API requiring Azure AD authentication

This app was made for my blog article series where we look at testing Azure AD-protected APIs.

  1. https://joonasw.net/view/testing-azure-ad-protected-apis-part-1-swagger-ui
  2. https://joonasw.net/view/testing-azure-ad-protected-apis-part-2-postman
  3. https://joonasw.net/view/testing-azure-ad-protected-apis-part-3-automated-integration-tests
  4. https://joonasw.net/view/testing-azure-ad-protected-apis-part-4-github-actions-ci-workflow
  5. https://joonasw.net/view/testing-azure-ad-protected-apis-part-5-pipelines-in-azure-devops

Bearer JWT (Server generate token)

https://pradeeploganathan.com/security/jwt/

https://pradeeploganathan.com/security/jwt-tokenserver/ (JWT – CREATING A TOKEN SERVER)

https://pradeeploganathan.com/angular/jwt-angular-interceptor/

Serialize Exceptions as JSON

https://pradeeploganathan.com/api/serialize-exceptions-as-json-using-custom-middleware-in-net-core/

ISO 8601 Date

The formats for an ISO8601 date are as follows:

  • Year: YYYY (2018)
  • Year and month: YYYY-MM (2018-04)
  • Complete date: YYYY-MM-DD (2018-04-25)
  • Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (2018-04-25T18:00+01:00)
  • Complete date plus hours, minutes, and seconds: YYYY-MM-DDThh:mm:ssTZD (2018-04-25T18:00:30+01:00)
  • Complete date plus hours, minutes, seconds, and a decimal fraction of a second: YYYY-MM-DDThh:mm:ss.sTZD (2018-04-25T18:00:30.45+01:00)

The letters used in the above format are:

  • YYYY: Four-digit year
  • MM: Two-digit month (01 = January, and so on)
  • DD: Two-digit day of month (01 through 31)
  • hh: Two digits of hour (00 through 23, a.m./p.m. NOT allowed)
  • mm: Two digits of minute (00 through 59)
  • ss: Two digits of second (00 through 59)
  • s: One or more digits representing a decimal fraction of a second
  • TZD: Time zone designator (Z or +hh:mm or -hh:mm)

Categories

Recent posts