forked from Alexey/DAS_2024_1
37 lines
859 B
C#
37 lines
859 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using ApiRestaurant.Models;
|
|
using ApiRestaurant;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
var waiterApiAddress =
|
|
Environment.GetEnvironmentVariable("WAITER_API_URL")
|
|
?? "http://localhost:4000/waiters/";
|
|
WaiterApiClient.Setup(waiterApiAddress);
|
|
await NetworkSupport.CheckConnectionAsync(waiterApiAddress);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddDbContext<RestaurantContext>(opt =>
|
|
opt.UseInMemoryDatabase("ApiRestaurant"));
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|