tesses.http/Tesses.Http.Example/MainServer.cs

25 lines
616 B
C#
Raw Normal View History

2022-08-22 17:30:32 +00:00
using System.Text;
using Tesses.Http;
internal class MainServer : ASPEndpointRequestHandler
{
public MainServer()
{
}
[HttpGet("/")]
public IResponse Index(int a)
{
return String($"{a} is 42");
}
[HttpGet("/form")]
public void SomePage(ServerContext ctx)
{
ctx.Response.StatusLine=200;
ctx.Response.SendStatusCodeHtml();
}
[HttpGet("/4ever4me")]
public IResponse ForEverForMe()
{
return File(System.IO.File.OpenRead("/home/mike/Music/Demi Lovato/Holy Fvck/16 4 EVER 4 ME.mp3"),"audio/mpeg","4Ever4Me.mp3",true);
}
}