|
@@ -23,20 +23,19 @@ shared static this()
|
|
|
listenHTTP(settings, router);
|
|
|
}
|
|
|
|
|
|
-class WebInterface {
|
|
|
- private {
|
|
|
- MongoCollection _worldCollection;
|
|
|
- MongoCollection _fortuneCollection;
|
|
|
- }
|
|
|
+MongoCollection _worldCollection;
|
|
|
+MongoCollection _fortuneCollection;
|
|
|
|
|
|
- this()
|
|
|
- {
|
|
|
- import std.process : environment;
|
|
|
- auto db = connectMongoDB(environment["DBHOST"]);
|
|
|
- _worldCollection = db.getCollection("hello_world.World");
|
|
|
- _fortuneCollection = db.getCollection("hello_world.Fortune");
|
|
|
- }
|
|
|
+// sets up the MongoDB connection pools for each thread
|
|
|
+static this()
|
|
|
+{
|
|
|
+ import std.process : environment;
|
|
|
+ auto db = connectMongoDB(environment["DBHOST"]);
|
|
|
+ _worldCollection = db.getCollection("hello_world.World");
|
|
|
+ _fortuneCollection = db.getCollection("hello_world.Fortune");
|
|
|
+}
|
|
|
|
|
|
+class WebInterface {
|
|
|
// GET /
|
|
|
void get()
|
|
|
{
|