41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
namespace Yunda.SOMS.DataMonitoringServer.Service
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddAuthorization();
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
app.UseAuthorization();
|
|
|
|
var summaries = new[]
|
|
{
|
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
};
|
|
//app.UseSwagger();
|
|
//app.UseSwaggerUI();
|
|
app.MapGet("/weatherforecast", (HttpContext httpContext) =>
|
|
{
|
|
var forecast = Enumerable.Range(1, 5).Select(index =>
|
|
new WeatherForecast
|
|
{
|
|
Date = DateTime.Now.AddDays(index),
|
|
TemperatureC = Random.Shared.Next(-20, 55),
|
|
Summary = summaries[Random.Shared.Next(summaries.Length)]
|
|
})
|
|
.ToArray();
|
|
return forecast;
|
|
});
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
} |