Created
March 14, 2024 13:28
-
-
Save bjoerntx/79ecd45b9842826432224ffb91628c62 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; | |
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(); | |
}); | |
}); | |
// adding controllers for DocumentViewer Web API | |
builder.Services.AddControllers(); | |
var app = builder.Build(); | |
app.MapGet("/", () => "TX Text Control .NET Server for ASP.NET Backend is up and running!"); | |
app.UseRouting(); | |
// adding CORS middleware | |
app.UseCors(); | |
// adding WebSockets middleware | |
app.UseWebSockets(); | |
// adding TX Text Control middleware | |
app.UseTXWebSocketMiddleware(); | |
app.UseTXDocumentViewer(); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment