summaryrefslogtreecommitdiffhomepage
path: root/source/app.d
diff options
context:
space:
mode:
Diffstat (limited to 'source/app.d')
-rw-r--r--source/app.d22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/app.d b/source/app.d
new file mode 100644
index 0000000..7b7c3fd
--- /dev/null
+++ b/source/app.d
@@ -0,0 +1,22 @@
+import brpaste;
+
+import vibe.d;
+
+int main(string[] args)
+{
+ auto settings = new HTTPServerSettings;
+ settings.port = 8080;
+ settings.bindAddresses = [];
+
+ readOption("bind|b", &settings.bindAddresses, "Sets the address to bind to");
+ readOption("port|p", &settings.port, "Sets the port to listen on");
+ if(settings.bindAddresses.length == 0) settings.bindAddresses = [ "127.0.0.1" ];
+
+ auto router = new URLRouter;
+ router.registerWebInterface(new BRPaste);
+ listenHTTP(settings, router);
+
+ import std.conv;
+ logInfo("Please open http://%s:%d/ in your browser.", settings.bindAddresses[0], settings.port);
+ return runApplication();
+}