-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (16 loc) · 763 Bytes
/
Copy pathProgram.cs
File metadata and controls
28 lines (16 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using SpaceCheckSimple;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddSingleton<DataService>();
builder.Services.AddSingleton<AlertService>();
builder.Services.AddSingleton<EmailService>();
builder.Services.AddHealthChecks();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGet("/", () => "Valid endpoints: /last (dashbloard lol), /testmail (sends test email)");
app.MapGet("/post/machine/{machine}/percent_full/{percent_use}",
(string machine, int percent_use, DataService ds) =>
ds.Add(machine, percent_use, DateTime.Now));
app.MapGet("/last", (DataService ds) => ds.GetLast());
app.MapGet("/testmail", (EmailService em) => em.TestEmail());
app.Run();