|
|
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
|
|
4
|
4
|
using Microsoft.AspNetCore.Builder;
|
|
5
|
5
|
using Microsoft.AspNetCore.Hosting;
|
|
6
|
6
|
using Microsoft.AspNetCore.Mvc.Authorization;
|
|
|
7
|
+using Microsoft.AspNetCore.ResponseCompression;
|
|
7
|
8
|
using Microsoft.EntityFrameworkCore;
|
|
8
|
9
|
using Microsoft.Extensions.Configuration;
|
|
9
|
10
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
@@ -31,6 +32,15 @@ namespace BulkPrintingAPI
|
|
31
|
32
|
|
|
32
|
33
|
public void ConfigureServices(IServiceCollection services)
|
|
33
|
34
|
{
|
|
|
35
|
+ services.Configure<GzipCompressionProviderOptions>(options =>
|
|
|
36
|
+ {
|
|
|
37
|
+ options.Level = System.IO.Compression.CompressionLevel.Optimal;
|
|
|
38
|
+ });
|
|
|
39
|
+ services.AddResponseCompression(options =>
|
|
|
40
|
+ {
|
|
|
41
|
+ options.EnableForHttps = true;
|
|
|
42
|
+ options.Providers.Add<GzipCompressionProvider>();
|
|
|
43
|
+ });
|
|
34
|
44
|
services.AddMemoryCache();
|
|
35
|
45
|
services.AddMvc(config =>
|
|
36
|
46
|
{
|
|
|
@@ -81,6 +91,8 @@ namespace BulkPrintingAPI
|
|
81
|
91
|
TokenValidationParameters = tokenValidationParameters
|
|
82
|
92
|
};
|
|
83
|
93
|
|
|
|
94
|
+ app.UseResponseCompression();
|
|
|
95
|
+
|
|
84
|
96
|
app.UseMiddleware<ExceptionHandlerMiddleware>();
|
|
85
|
97
|
|
|
86
|
98
|
app.UseJwtBearerAuthentication(bearerOptions);
|