Static Websites
Live on this serverHosts a static website, with index.html support.
using GenHTTP.Api.Content;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.StaticWebsites;
public static class StaticWebsiteSample
{
public static IHandlerBuilder Create()
{
/*
*
* Serves a static website from a directory (or resource tree in general).
*
* See https://genhttp.org/documentation/content/frameworks/static-websites/
*
*/
// shipped with this website (resources/samples/website), use ResourceTree.FromDirectory("/var/www") to serve a folder
var files = Resources.Tree("samples/website");
// GET /samples/static-website/ serves index.html
return StaticWebsite.From(files);
}
}Try it
Send the requests to the sample running on this server - change the path, headers or body as you like, or copy them as curl commands.
Open the website