I just started my first vibe.d project, but I can't get a simple example from the website to compile. I started by using dub init
"dependencies": {
"vibe-d": ">=0.7.15"
},
"versions": [
"VibeCustomMain"
]
I then ran dub upgrade, opened up app.d, and pasted in this:
import vibe.d;
void userInfo(HTTPServerRequest req, HTTPServerResponse res)
{
auto username = req.params["user"];
render!("userinfo.jd", username)(res);
}
void addUser(HTTPServerRequest req, HTTPServerResponse res)
{
res.redirect("/users/"~req.post["user"]);
}
shared static this()
{
auto router = new URLRouter;
router.get("/users/:user", &userInfo);
router.post("/adduser", &addUser);
router.get("*", serveStaticFiles("./public/"));
// To reduce code redundancy, you can also
// use method chaining:
router
.get("/users/:user", &userInfo)
.post("/adduser", &addUser);
.get("*", serveStaticFiles("./public/"));
listenHTTP(new HTTPServerSettings, router);
}
From the vibe.d website. When I tried to compile, however, I got the error:Error: module d is in file vibe/d.d, which cannot be read
.
I tried adding the path to /vibe-d/bin
to the Path variable, but it didn't help at all. can anyone suggest a way to get this to compile?