Search in sources :

Example 1 with StoreEndpoint

use of io.georocket.http.StoreEndpoint in project georocket by georocket.

the class GeoRocket method createRouter.

/**
 * Create a {@link Router} and add routes for <code>/store/</code>
 * to it. Sub-classes may override if they want to add further routes
 * @return the created {@link Router}
 */
protected Router createRouter() {
    Router router = Router.router(vertx);
    Endpoint storeEndpoint = createStoreEndpoint();
    router.mountSubRouter("/store", storeEndpoint.createRouter());
    Endpoint generalEndpoint = createGeneralEndpoint();
    router.mountSubRouter("/", generalEndpoint.createRouter());
    router.route().handler(ctx -> {
        String reason = "The endpoint " + ctx.request().path() + " does not exist";
        ctx.response().setStatusCode(404).end(ServerAPIException.toJson("endpoint_not_found", reason).toString());
    });
    return router;
}
Also used : GeneralEndpoint(io.georocket.http.GeneralEndpoint) Endpoint(io.georocket.http.Endpoint) StoreEndpoint(io.georocket.http.StoreEndpoint) Router(io.vertx.ext.web.Router)

Aggregations

Endpoint (io.georocket.http.Endpoint)1 GeneralEndpoint (io.georocket.http.GeneralEndpoint)1 StoreEndpoint (io.georocket.http.StoreEndpoint)1 Router (io.vertx.ext.web.Router)1