June 20, 2018 Vibe D Examples | ||||
---|---|---|---|---|
| ||||
I'm trying to reacquaint myself with D, and Vibe in particular. I notice that some of my previous working apps now don't work. While going through the tour.dlang page, I can't seem to get any of those sample apps working either. Nor do the apps in Vibe's github page appear to be up to date with the recent changes. Are there some current, simple, working examples that I could plagiarise to get something going? TIA Brian |
June 21, 2018 Re: Vibe D Examples | ||||
---|---|---|---|---|
| ||||
Posted in reply to infinityplusb | On Wednesday, 20 June 2018 at 22:46:16 UTC, infinityplusb wrote: > I'm trying to reacquaint myself with D, and Vibe in particular. > I notice that some of my previous working apps now don't work. > > While going through the tour.dlang page, I can't seem to get any of those sample apps working either. Nor do the apps in Vibe's github page appear to be up to date with the recent changes. > > Are there some current, simple, working examples that I could plagiarise to get something going? > > TIA > Brian Nevermind. Simple case of RTFM ... -- source/app.d import vibe.d; void main() { auto settings = new HTTPServerSettings("127.0.0.1"); settings.port = 48081; auto router = new URLRouter ; router .get("/", &homeScreen) ; listenHTTP(settings, router); runApplication(); } void homeScreen(HTTPServerRequest req, HTTPServerResponse res) { // res.writeBody("Hello again Vibe.d: "); res.render!("home.dt") ; } -- views/home.dt doctype html5 head title Hello World body p Hello template vibe |
Copyright © 1999-2021 by the D Language Foundation