Skip to content

Commit

Permalink
feat: cors
Browse files Browse the repository at this point in the history
* response compression

* brotli

* bug fix at response caching

* docs

* appsettings.json

* fix: change username

* feat: net 6 upgrade

* ci: fix net version

* fix: username

* ci: fix test

* ci: vercel.json [skip_ci]

* fix: remove vercel [skip ci]

* feat: cors

* fix: vercel
  • Loading branch information
brunobritodev authored Apr 5, 2023
1 parent a18fa3e commit f96ea8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
6 changes: 5 additions & 1 deletion src/AwesomeGithubStats.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public void ConfigureServices(IServiceCollection services)
options.EnableForHttps = true;
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/jpeg", "image/png", "application/font-woff2", "image/svg+xml", MediaTypeNames.Application.Json });
});

services.AddCors(options => {
options.AddPolicy("AllowAnyOrigin",
builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
});
services.Configure<BrotliCompressionProviderOptions>(options =>
{
options.Level = CompressionLevel.Optimal;
Expand All @@ -73,6 +76,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Awesome Github Stats v1"));
}

app.UseCors("AllowAnyOrigin");
app.UseHttpsRedirection();
app.UseDefaultFiles(new DefaultFilesOptions() { DefaultFileNames = new[] { "index.html" } });
app.UseStaticFiles();
Expand Down
12 changes: 0 additions & 12 deletions vercel.json

This file was deleted.

0 comments on commit f96ea8a

Please sign in to comment.