source: iknow-api/Program.cs@ 8e32210

Last change on this file since 8e32210 was 271178d, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

Refactor all namespaces to iknow_api

  • Property mode set to 100644
File size: 859 bytes
RevLine 
[618be76]1using Microsoft.EntityFrameworkCore;
[9694de9]2using iknow_api.Core.Data;
[271178d]3using iknow_api.Services;
4using iknow_api.Repositories;
[618be76]5
[c11d3a3]6var builder = WebApplication.CreateBuilder(args);
7
8// Add services to the container.
9builder.Services.AddControllers();
10builder.Services.AddOpenApi();
11
[fc7b4b4]12// Register DbContext
[c0a75ab]13builder.Services.AddDbContext<AppDbContext>(options =>
14 options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
15
[fc7b4b4]16// Register your services
17builder.Services.AddScoped<IAuthService, AuthService>();
18builder.Services.AddScoped<IUserRepository, UserRepository>(); // You'll need to add the UserRepository implementation
[9694de9]19
[c11d3a3]20var app = builder.Build();
21
22// Configure the HTTP request pipeline.
23if (app.Environment.IsDevelopment())
24{
25 app.MapOpenApi();
26}
27
28app.UseHttpsRedirection();
29app.UseAuthorization();
30app.MapControllers();
31
32app.Run();
Note: See TracBrowser for help on using the repository browser.