2015-12-21 43 views
0

下面是胶水清单我用它来启动服务器:高致病性禽流感,招摇禁用我的路线

var Config = require('../config.json'); 

var internals = { 
    manifest: { 
     connections: [ 
     { 
      host : Config.host || process.env.IP, 
      port : Config.apiPort || process.env.PORT, 
      labels : ['api'] 
     }], 
     plugins: { 
      './decorate': [{ 'select': ['api']}], 
      'hapi-auth-jwt': [{ 'select': ['api']}], 
      './authentication': [{ 'select': ['api']}], 
      './controllers': [{ 'select': ['api']}], 
      './models': [{ 'select': ['api']}], 
      './api': [{ 'select': ['api']}], 
      good: { 
       opsInterval: 5000, 
       reporters: [ 
        { 'reporter': 'good-console', 'events': { 'log': '*' } } 
       ] 
      } 
     } 
    } 
}; 
if (!process.env.PRODUCTION) { 
    internals.manifest.plugins['blipp'] = [{}]; 
    internals.manifest.plugins['good'].reporters[0].events['ops'] = '*'; 
} 

module.exports = internals.manifest; 

只要我加上“高致病性禽流感,招摇”到插件列表服务器停止响应./api文件中定义的路由。没有一条路线可行。添加hapi-swagger到胶水清单是正确的方法还是我做一些荒谬的事情?

编辑:下面是api.js

exports.register = function (plugin, options, next) { 

    plugin.dependency('controllers'); 
    plugin.dependency('models'); 

    var Controllers = plugin.plugins.controllers.handlers; 
    var Models = plugin.plugins.models.models; 
    plugin.bind({ 
     models: Models 
    }); 

    plugin.route([ 
     { method: 'GET', path: '/token',    config: Controllers.Membership.token }, 

     { method: 'GET', path: '/',     config: Controllers.Home.status }, 
     { method: 'GET', path: '/nodes',    config: Controllers.Node.search }, 
     { method: 'GET', path: '/services',   config: Controllers.Node.services }, 

     { method: 'GET', path: '/createnodetree', config: Controllers.Loader.createNodeTree } 
    ]); 

    next(); 
}; 



exports.register.attributes = { 
    name: 'api', 
    version: require('../package.json').version 
}; 
+0

你的'api.js'文件是什么样的? –

+0

你使用的是什么版本的hapi和hapi-swagger? – mikefrey

回答

0

发生这种情况,如果您尝试使用高致病性禽流感,不招摇既包括文档视图相关性或正常禁用文档支持。来自docs

如果您想查看API的文档,您还需要安装支持模板和静态内容服务的惰性和视觉插件。如果你只想使用swagger.json而没有例如swagger-codegen的文档,只需将options.enableDocumentation设置为false即可。

你没告诉你是如何加入高致病性禽流感,招摇插件,但你只需要添加'enableDocumentation': false期权无论你定义。你可以在上面的链接找到例子。