swaggerize 0.2.0

A swagger library for vibe-d server.


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

dub.json
dub.sdl

Swaggarize

Swagger library for D programming language

How to use it

Create handlers

module myapp.handlers;

import vibe.d;
import swaggerize.composites;

@swaggerPath("/hello", OperationsType.options)
void optionsList(string name)(HTTPServerRequest /*req*/, HTTPServerResponse res) {
  res.writeBody("hello world!");
}

Create vibe.d instance

import vibe.d;
import swaggerize.parser;
import swaggerize.composites;
import myapp.handlers;

MongoClient client;

shared static this()
{
  auto definitions = swaggerizeJson("./api.json");

  auto settings = new HTTPServerSettings;
  settings.port = 8080;
  settings.options = HTTPServerOption.parseQueryString | HTTPServerOption.parseJsonBody;

  client = connectMongoDB("127.0.0.1");

  auto router = new URLRouter;
  router.register!(myapp.handlers)(definitions);

  listenHTTP(settings, router);
}

Authors:Szabo Bogdan

Dependencies:vibe-d

Versions:
0.2.0 2016-Oct-23
0.1.6 2016-Aug-27
0.1.5 2016-Jul-17
0.1.4 2016-Apr-23
0.1.3 2016-Apr-21
Show all 9 versions
Stats:

statistics are temporarily disabled.