krakenjs / swaggerize-routes

Swagger document driven route builder.
Other
58 stars 57 forks source link

To make the api more dynamic let's introduce defaulthandler #71

Closed dankle closed 7 years ago

dankle commented 8 years ago

In our project we don't use the file mappings for the handlers but we use this module for generating the base of the route and then in a later stage add a default handler for all the routes. This is because we have our handlers refers to a js file that handles the logic for the different routes.

This PR integrates this functionality directly in swaggerize-routes which is very useful if you just want one handler for all routes.

Example:

var builder = require('swaggerize-routes');

var routes = builder({
    api: require('./api.json'),
    defaulthandler: function (req, reply) {
       reply.('something');
    },
    security: './security' //Optional - security authorize handlers as per `securityDefinitions`
});
subeeshcbabu-zz commented 8 years ago

@dankle Can you update the README also for this.

dankle commented 8 years ago

@subeeshcbabu Sure, updated now.

dankle commented 7 years ago

@subeeshcbabu do you have a current plan for next release? Or maybe an estimate when it can be available?

subeeshcbabu-zz commented 7 years ago

@dankle - I am planning to release the changes by End of this week.

subeeshcbabu-zz commented 7 years ago

published version 1.0.10 - https://github.com/krakenjs/swaggerize-routes/blob/master/CHANGELOG.md#1010

dankle commented 7 years ago

@subeeshcbabu - Thanks!