-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
31 lines (23 loc) · 888 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using NetTopologySuite;
using NetTopologySuite.IO.Converters;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
// this constructor is overloaded. see other overloads for options.
var geoJsonConverterFactory = new GeoJsonConverterFactory();
options.JsonSerializerOptions.Converters.Add(geoJsonConverterFactory);
});
// nothing to do with NTS.IO.GeoJSON4STJ specifically, but a recommended
// best-practice is to inject this instead of using the global variable:
builder.Services.AddSingleton(NtsGeometryServices.Instance);
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();