vibedstruct2mongo ~master

Mongo pooler for use with vibe.d


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl
import vibe.vibe;
import vibedstruct2mongo;
import struct2mongo;

MongoDBConnection mongoPool;

shared static this()
{
  mongoPool = new MongoDBConnection("mongodb://localhost", 2);

  auto settings = new HTTPServerSettings;
  settings.port = 8089;
  settings.bindAddresses = ["::1", "127.0.0.1"];
  listenHTTP(settings, &hello);

  logInfo("Please open http://127.0.0.1:8080/ in your browser.");
  runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
  res.writeBody("Hello, World!");

  auto col = Col (mongoPool[`newBase`][`newCollection`]);

  struct Example {
    int a = 0;
  }

  col.insert(Example(5));
}
Authors:
  • Christian Durán C
Dependencies:
vibe-d, struct2mongo, vibe-d:tls, mondo
Versions:
0.1.0 2018-Jan-29
~master 2018-Jan-29
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 2 downloads total

Score:
0.3
Short URL:
vibedstruct2mongo.dub.pm