summaryrefslogtreecommitdiffhomepage
path: root/source/app.d
blob: c6ac6c570c6d42eacec4b700f77eaa93a87b1005 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import brpaste;

import vibe.d;

shared static this() {
    auto settings = new HTTPServerSettings;
    settings.port = 8080;
    settings.bindAddresses = [];

    readOption("bind|b", &settings.bindAddresses, "Sets the addresses to bind to [127.0.0.1 ::1]");
    readOption("port|p", &settings.port, "Sets the port to listen on [8080]");
    if(settings.bindAddresses.empty) settings.bindAddresses = [ "127.0.0.1", "::1" ];

    auto router = new URLRouter;
    router.registerWebInterface(new BRPaste);
    listenHTTP(settings, router);
}