1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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();
- }
- }
- }
|