convert to use service

This commit is contained in:
2023-01-05 10:32:21 -05:00
parent 596065b7c8
commit 2caa82b8f4
5 changed files with 51 additions and 19 deletions

View File

@ -1,7 +1,10 @@
using BinaryDad.Notes.Services;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddSingleton<INoteService, FileNoteService>();
var app = builder.Build();
@ -13,15 +16,6 @@ if (!app.Environment.IsDevelopment())
app.UseHsts();
}
// create file
var configuration = app.Services.GetService<IConfiguration>();
var filePath = configuration["ContentFilePath"];
if (!File.Exists(filePath))
{
File.WriteAllText(filePath, "Hi! Feel free to start typing. Everything will be saved soon after you are done typing.");
}
app.UseHttpsRedirection();
app.UseStaticFiles();