Created
March 20, 2024 08:57
-
-
Save bjoerntx/5e2e9e2e4ed96ffa6ebfe23bb3cd6649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TXTextControl.Web.MVC.DocumentViewer; | |
var builder = WebApplication.CreateBuilder(args); | |
// adding CORS policy to allow all origins | |
builder.Services.AddCors(options => | |
{ | |
options.AddDefaultPolicy( | |
builder => | |
{ | |
builder.AllowAnyOrigin() | |
.AllowAnyMethod() | |
.AllowAnyHeader(); | |
}); | |
}); | |
// Add services to the container. | |
builder.Services.AddControllers(); | |
var app = builder.Build(); | |
app.UseDefaultFiles(); | |
app.UseStaticFiles(); | |
// Configure the HTTP request pipeline. | |
app.UseHttpsRedirection(); | |
app.UseAuthorization(); | |
app.UseRouting(); | |
// adding CORS middleware | |
app.UseCors(); | |
app.UseTXDocumentViewer(); | |
app.MapControllers(); | |
app.MapFallbackToFile("/index.html"); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment