|
Last change
on this file since 9538edc was 277bd72, checked in by stefansaveski <stefansaveski19@…>, 11 months ago |
|
Refactor all namespaces to iknow_api
|
-
Property mode
set to
100644
|
|
File size:
859 bytes
|
| Line | |
|---|
| 1 | using Microsoft.EntityFrameworkCore;
|
|---|
| 2 | using iknow_api.Core.Data;
|
|---|
| 3 | using iknow_api.Services;
|
|---|
| 4 | using iknow_api.Repositories;
|
|---|
| 5 |
|
|---|
| 6 | var builder = WebApplication.CreateBuilder(args);
|
|---|
| 7 |
|
|---|
| 8 | // Add services to the container.
|
|---|
| 9 | builder.Services.AddControllers();
|
|---|
| 10 | builder.Services.AddOpenApi();
|
|---|
| 11 |
|
|---|
| 12 | // Register DbContext
|
|---|
| 13 | builder.Services.AddDbContext<AppDbContext>(options =>
|
|---|
| 14 | options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
|
|---|
| 15 |
|
|---|
| 16 | // Register your services
|
|---|
| 17 | builder.Services.AddScoped<IAuthService, AuthService>();
|
|---|
| 18 | builder.Services.AddScoped<IUserRepository, UserRepository>(); // You'll need to add the UserRepository implementation
|
|---|
| 19 |
|
|---|
| 20 | var app = builder.Build();
|
|---|
| 21 |
|
|---|
| 22 | // Configure the HTTP request pipeline.
|
|---|
| 23 | if (app.Environment.IsDevelopment())
|
|---|
| 24 | {
|
|---|
| 25 | app.MapOpenApi();
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | app.UseHttpsRedirection();
|
|---|
| 29 | app.UseAuthorization();
|
|---|
| 30 | app.MapControllers();
|
|---|
| 31 |
|
|---|
| 32 | app.Run();
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.