27 lines
516 B
C#
27 lines
516 B
C#
using Ocelot.DependencyInjection;
|
|
using Ocelot.Middleware;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Make sure to add the Ocelot configuration file
|
|
builder.Configuration.AddJsonFile("ocelot.json");
|
|
|
|
// Add Ocelot services
|
|
builder.Services.AddOcelot();
|
|
|
|
var app = builder.Build();
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseRouting();
|
|
app.UseAuthorization();
|
|
|
|
// Use Ocelot middleware in an appropriate way
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapControllers();
|
|
});
|
|
|
|
app.UseOcelot().Wait();
|
|
|
|
app.Run();
|