constructor() {
    this.defaultHeaders = {
      "Accept-Encoding": "identity",
      "Access-Control-Allow-Headers":
        global.kuzzle.config.http.accessControlAllowHeaders,
      "Access-Control-Allow-Methods":
        global.kuzzle.config.http.accessControlAllowMethods,
      "content-type": "application/json",
    };

    if (global.kuzzle.config.http.cookieAuthentication) {
      this.defaultHeaders["Access-Control-Allow-Credentials"] = "true";
    }

    if (global.kuzzle.config.server.protocols.http.allowCompression === true) {
      this.defaultHeaders["Accept-Encoding"] = "gzip,deflate,identity";
    }

    this.routes = {
      DELETE: new RoutePart(),
      GET: new RoutePart(),
      HEAD: new RoutePart(),
      PATCH: new RoutePart(),
      POST: new RoutePart(),
      PUT: new RoutePart(),
    };

    // Add an automatic HEAD route on the '/' url, answering with default headers
    attach(
      "/",
      (request, cb) => {
        request.setResult({}, 200);
        cb(request);
      },
      this.routes.HEAD,
    );
  }
Attach handler to routes and dispatch a HTTP
message to the right handler

Handlers will be called with the following arguments:
  - request: received HTTP request
  - response: HTTP response object
  - data: URL query arguments and/or POST data, if any

@class Router