dlang website design
Sönke Ludwig via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 24 13:29:23 PDT 2017
Am 24.06.2017 um 21:22 schrieb Ecstatic Coder:
> package main
>
> import (
> "log"
> "net/http"
> )
>
> func main() {
> http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
> http.ServeFile(w, r, r.URL.Path[1:]);
> });
>
> log.Fatal(http.ListenAndServe(":80", nil));
> }
/++ dub.sdl
name "webserver"
dependency "vibe-d:http" version="~>0.7.31"
+/
module main;
import vibe.core.core;
import vibe.http.fileserver;
import vibe.http.server;
void main()
{
listenHTTP(new HTTPServerSettings, serveStaticFiles("./"));
runApplication();
}
$ dub main.d
Although of course vibe.d is not included with the compiler, this works
out of the box for a standard DMD/LDC installation.
More information about the Digitalmars-d
mailing list