dlang website design

Ecstatic Coder via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 24 14:04:36 PDT 2017


On Saturday, 24 June 2017 at 20:29:23 UTC, Sönke Ludwig wrote:
> 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.

Exactly what I mean.

Just rename the three imports into std.*, make this available at 
installation, et voilà :)

Should not require too much work...



More information about the Digitalmars-d mailing list