vibed: how to use pure HTML instead of template engine?
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 7 11:59:12 PDT 2015
shared static this()
{
auto router = new URLRouter;
router.get("/", &root);
auto settings = new HTTPServerSettings;
settings.port = 8080;
listenHTTP(settings, router);
}
void root(HTTPServerRequest req, HTTPServerResponse res)
{
serveStaticFiles("public/");
}
1. Do I need write "./public/" ? In examples often simply
"public/"
2. What incoming parameters ("HTTPServerRequest req,
HTTPServerResponse res") mean? Why I should to specify them?
3. Why code with: "res.writeBody("Hello, World!", "text/plain");"
and "router.get("*", serveStaticFiles("./public/"));" also work,
but my variant (see code above) do not load say that page not
found?
4. How to specify page that I need to load, why in examples there
is only link to folder like public? But what if I want to load
public/foo.html?
More information about the Digitalmars-d-learn
mailing list