Подключил blazor к api, теперь для работы АИС, достаточно запустить backend

This commit is contained in:
Hukuta committed 2026-05-29 22:57:46 +09:00
1 parent d1ea7b812c
commit 213c590e95
36 files changed
+26 -870

No files matched your search

+21 -13
View File
@@ -1,5 +1,5 @@
using CartriX.Api.Interfaces;
using CartriX.Api.Services;
//using CartriX.Api.Interfaces;
//using CartriX.Api.Services;
using CartriX.Api.Classes;
using Microsoft.EntityFrameworkCore;
using Scalar.AspNetCore;
@@ -9,16 +9,16 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddScoped<IPrinterService, PrinterService>();
builder.Services.AddScoped<ICartridgeService, CartridgeService>();
builder.Services.AddScoped<ILocationService, LocationService>();
builder.Services.AddScoped<IReportService, ReportService>();
builder.Services.AddScoped<INetworkService, NetworkService>();
builder.Services.AddScoped<IManufacturerService, ManufacturerService>();
builder.Services.AddScoped<IArticleService, ArticleService>();
//builder.Services.AddScoped<IPrinterService, PrinterService>();
//builder.Services.AddScoped<ICartridgeService, CartridgeService>();
//builder.Services.AddScoped<ILocationService, LocationService>();
//builder.Services.AddScoped<IReportService, ReportService>();
//builder.Services.AddScoped<INetworkService, NetworkService>();
//builder.Services.AddScoped<IManufacturerService, ManufacturerService>();
//builder.Services.AddScoped<IArticleService, ArticleService>();
builder.Services.AddSingleton<ISnmpService, SnmpService>();
builder.Services.AddHostedService<BackgroundApiService>();
//builder.Services.AddSingleton<ISnmpService, SnmpService>();
//builder.Services.AddHostedService<BackgroundApiService>();
builder.Services.AddCors(options =>
{
@@ -32,7 +32,7 @@ builder.Services.AddCors(options =>
});
builder.WebHost.UseUrls(
"http://localhost:5197"
"http://0.0.0.0:5000"
);
builder.Services.AddOpenApi(options =>
@@ -55,9 +55,17 @@ builder.Services.AddDbContext<AppDbContext>(options =>
var app = builder.Build();
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();
app.UseRouting();
app.UseCors("AllowAll");
app.MapControllers();
app.MapFallbackToFile("index.html");
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
@@ -76,6 +84,6 @@ if (app.Environment.IsDevelopment())
options.Theme = ScalarTheme.DeepSpace;
});
}
app.MapControllers();
app.Run();