0.1.2 • Published 11 years ago

hapi-swagger-models v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
11 years ago

hapi-swagger-models

This is a plugin for HAPI v6 or 7. When installed it will generate javascript models from a self-documenting Swagger API. Currently only Backbone models are supported.

Install

You can add the module to your HAPI project using npm:

$ npm install hapi-swagger-models --save

Adding the plug-in into your project

In your server init file, add the following code after you have created the server object:

server.pack.register({
    plugin: require('hapi-swagger-models'),
    options: {
        api: 'http://localhost:8000/docs',
        filePath: '/static/models/models.js'
    }
}, function(err) {
    if (err) {
        server.log('hapi-swagger-models load error: ' + err);
    }
});

Testing your config

If you get no errors in the log, you should be able to now access your running HAPI project and add /static/models/models.js (or whatever file path values you supplied) to the end of your root URL to see the backbone models generated.

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago