0
以下的NodeJS哈皮代码生成错误在http://localhost:3000/documentation扬鞭,高致病性禽流感:路径/模型产生错误
查询时如果我更改为/型号别的东西端点的路径,像/用户例如,一切运作良好。它看起来像保留了端点/模型。
任何想法为什么任何其他端点的工作除了/模型?我该如何解决它?我无法更改网址,因为有太多人使用它。
var Hapi = require('hapi'),
Inert = require('inert'),
Vision = require('vision'),
Joi = require('joi'),
HapiSwagger = require('hapi-swagger')
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 3000
});
var swaggerOptions = {
apiVersion: "1.0"
};
server.register([
Inert,
Vision,
{
register: HapiSwagger,
options: swaggerOptions
}], function (err) {
server.start(function(){
// Add any server.route() config here
console.log('Server running at:', server.info.uri);
});
});
server.route(
{
method: 'GET',
path: '/models',
config: {
handler: function (request, reply) {
reply("list of models")
},
description: 'Get todo',
notes: 'Returns a todo item by the id passed in the path',
tags: ['api'],
validate: {
params: {
username: Joi.number()
.required()
.description('the id for the todo item')
}
}
}
}
)
server.start(function(){
// Add any server.route() config here
console.log('Server running at:', server.info.uri);
});