init: initial commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using Application.Aggregates.Users;
|
||||
using Domain.Aggregates.Users.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Persistence;
|
||||
using Persistence.Repositories.Aggregates.Users;
|
||||
using Server.Infrastructure.Extensions.ServiceCollections;
|
||||
|
||||
namespace Server;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
// Add Settings
|
||||
builder.AddConfiguration();
|
||||
|
||||
// Add Database
|
||||
builder.Services.AddDbContext<DatabaseContext>(opt =>
|
||||
{
|
||||
opt.UseSqlite("Data Source=../../../db/database.db");
|
||||
});
|
||||
|
||||
// Add DI's
|
||||
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
||||
builder.Services.AddScoped<UsersApplication>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapStaticAssets();
|
||||
app.MapRazorPages()
|
||||
.WithStaticAssets();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user