48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
|
|
using Microsoft.AspNetCore.Builder;
|
||
|
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
using Microsoft.Extensions.Hosting;
|
||
|
|
using Microsoft.AspNetCore.Mvc.Razor;
|
||
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||
|
|
using PlanTempus.Application.Features.Localization.Services;
|
||
|
|
using PlanTempus.Application.Features.Menu.Services;
|
||
|
|
|
||
|
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
|
||
|
|
// Add Razor Pages with feature-based structure
|
||
|
|
builder.Services.AddRazorPages(options =>
|
||
|
|
{
|
||
|
|
options.RootDirectory = "/Features";
|
||
|
|
})
|
||
|
|
.AddRazorOptions(options =>
|
||
|
|
{
|
||
|
|
// View locations for partials and ViewComponents
|
||
|
|
options.ViewLocationFormats.Add("/Features/_Shared/Pages/{0}.cshtml");
|
||
|
|
options.ViewLocationFormats.Add("/Features/_Shared/Components/{1}/{0}.cshtml");
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
// Register application services
|
||
|
|
builder.Services.AddScoped<IMenuService, MockMenuService>();
|
||
|
|
builder.Services.AddScoped<ILocalizationService, JsonLocalizationService>();
|
||
|
|
|
||
|
|
var app = builder.Build();
|
||
|
|
|
||
|
|
// Developer exception page for debugging
|
||
|
|
if (app.Environment.IsDevelopment())
|
||
|
|
{
|
||
|
|
app.UseDeveloperExceptionPage();
|
||
|
|
}
|
||
|
|
|
||
|
|
// Serve static files from wwwroot
|
||
|
|
app.UseStaticFiles();
|
||
|
|
|
||
|
|
// Configure routing
|
||
|
|
app.UseRouting();
|
||
|
|
|
||
|
|
// Map Razor Pages
|
||
|
|
app.MapRazorPages();
|
||
|
|
|
||
|
|
app.Run("http://localhost:8000");
|
||
|
|
|
||
|
|
// Note: Set ASPNETCORE_ENVIRONMENT=Development for detailed error pages
|