Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created March 20, 2024 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/5e2e9e2e4ed96ffa6ebfe23bb3cd6649 to your computer and use it in GitHub Desktop.
Save bjoerntx/5e2e9e2e4ed96ffa6ebfe23bb3cd6649 to your computer and use it in GitHub Desktop.
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