dlang website design
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 24 15:18:29 PDT 2017
On 24.06.2017 22:29, 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.
>
$ cat main.d
/++ 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
readPackageRecipe called with filename with unknown extension: + dub.sdl
name "webserver"
dependency "vibe-d
What am I doing wrong?
More information about the Digitalmars-d
mailing list