dlang website design

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 24 14:38:00 PDT 2017


On 6/24/17 9:29 PM, 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.

This should be a blog post. -- Andrei



More information about the Digitalmars-d mailing list