Am 10/24/2012 12:06 PM, schrieb denizzzka:
static this() { auto h = new Handlers; setLogLevel(LogLevel.Debug); setLogFile("log.txt", LogLevel.Info); auto settings = new HttpServerSettings; //settings.hostName = "realty.com"; settings.port = 8080; settings.bindAddresses = ["127.0.0.1"]; settings.errorPageHandler = &h.error; auto router = new UrlRouter; router.get("/", &h.listHandler); router.get("/apartment", &h.dumbHandler); router.get("*", serveStaticFiles("./public/")); listenHttp(settings, router); } /// member of class h: void dumbHandler(HttpServerRequest req, HttpServerResponse res) { render!("apartment.dt", req)(res); }
apartment.dt template:
extends layout block content h1 #{ req.form }
url looks like: http://127.0.0.1:8080/apartment?id=123&qwe=123
this code always returns: []
why? I am can not get any arguments because this.
req.query
contains the parameters of a query string form (req.form
is for POST forms). I'll improve the docs there.