WeNerds.Middlewares 1.0.3

dotnet add package WeNerds.Middlewares --version 1.0.3
                    
NuGet\Install-Package WeNerds.Middlewares -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WeNerds.Middlewares" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WeNerds.Middlewares" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="WeNerds.Middlewares" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WeNerds.Middlewares --version 1.0.3
                    
#r "nuget: WeNerds.Middlewares, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WeNerds.Middlewares@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WeNerds.Middlewares&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=WeNerds.Middlewares&version=1.0.3
                    
Install as a Cake Tool

WE Middlewares

Open-source Commons FeatuMiddlewaresres developed to facilitate the creation of a new project in .Net, providing some commons middlewares.

Something is missing? Submit a new product feature request using the issues tracker..

✨ Using the library

👉 Step 1 - Install library into project

  • Package Manager
$ Install-Package WeNerds.Middlewares
  • .Net CLI
$ dotnet add package WeNerds.Middlewares

👉 Step 2 - Using the Middleware<br> After build the app in the program.cs, call the use method of the middleware:<br>

app.UseExceptionHandlerMiddleware(app.Configuration, app.Environment, app.Logger);
  • app.Configuration: Used for get the environment variable
  • app.Environment: Used for get the current environment
  • app.Logger: Used for log error

✨ About the Middleware

  • Exception Handler

This middleware aims to facilitate the handling of exceptions generated in the application. Any exception not handled by the application will be intercepted by this middleware and the following actions will be taken:

Production environment

If the environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION is true, a log will be generated using the ILogger service (Microsoft.Extensions.Logging).<br> This log contains the ErrorId and the generated exception data,and will be generated following the application's ILogger settings, so it can be generated for AWS, Console and others.<br> The HttpContext Response will not display anything regarding the exception that occurred. Only a Code Message, a Message containing the ErrorId and a StatusCode 500 will be sent to the requester.<br>

If the environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION is tfalse, the log generation will be ignored and the HttpContext will receive the same response as when the variable is true, but as no log was generated, there will be no way to check the error that occurred.

Development environment

In this case, the HttpContext will receive the detailed error that occurred, thus not needing to generate logs

Important <br> The environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION, can be created at appSettings.json or at environment variable of the Operational System.

✨ Contacts

📧 Email - leo.cavalheiro.ti@gmail.com

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 219 6/28/2024
1.0.2 201 6/28/2024
1.0.1 191 6/28/2024
1.0.0 203 6/27/2024