Adding first version of the api rewrite.

Removing many dependencies.
This commit is contained in:
2022-12-26 04:56:30 +01:00
parent c07a1c8ef3
commit bfcb895cb3
7 changed files with 364 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var welcomeMessage = "Go to bed server.";
var status = handler.FirstRun.status("https://github.com/Myxelium/go-to-bed/");
handler.MdsService.Start();
app.MapGet("/", () => Results.Text(welcomeMessage + "Status: " + status, "text/html"));
app.MapPost("/go-to-bed/sleep", () => handler.ShutdownCommand.Hibernate());
app.MapPost("/go-to-bed/shutdown", () => handler.ShutdownCommand.Shutdown());
app.MapPost("/go-to-bed/reboot", () => handler.ShutdownCommand.Reboot());
app.MapPost("/go-to-bed/logout", () => handler.ShutdownCommand.Logout());
app.MapPost("/go-to-bed/lock", () => handler.ShutdownCommand.Lock());
app.Run();