48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using Microsoft.OpenApi.Models;
|
|
using SimpleLIS;
|
|
using SimpleLIS.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
builder.Services.AddControllersWithViews();
|
|
builder.Services.AddAutoMapper(typeof(Program));
|
|
|
|
builder.Services.AddScoped<MessageService>();
|
|
builder.Services.AddScoped<ObservationService>();
|
|
builder.Services.AddScoped<PatientService>();
|
|
builder.Services.AddDbContext<HL7DbContext>();
|
|
|
|
builder.Services.AddSwaggerGen(options =>
|
|
{
|
|
options.SwaggerDoc("v1", new OpenApiInfo { Title = "SimpleLIS", Version = "v1" });
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI(c =>
|
|
{
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "SimpleLIS V1");
|
|
});
|
|
|
|
app.Run();
|