convert to use service
This commit is contained in:
12
Program.cs
12
Program.cs
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user