No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1162a41 Dec 3, 2014
Permalink
Failed to load latest commit information.
.gitignore Initial commit Oct 22, 2014
LICENSE Initial commit Oct 22, 2014
README.md Update Readme. Increment version Oct 22, 2014
index.js Update models Dec 2, 2014
package.json Update models Dec 2, 2014

README.md

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.