0
我对Node.js相当陌生,我在使用教程从下面的页面。Node.js postme methed request not working {“statusCode”:404,“error”:“Not Found”,“message”:“Not Found”}
http://www.9lessons.info/2017/02/create-restful-api-nodejs-mysql.html
现在这个问题我有与后method.When我调用任何其它则Get方法我得到这个错误
https://github.com/srinivastamada/NodeRestful/blob/master/server.js
server.route({
method: 'POST',
path: '/messages',
handler: function (request, reply) {
const uid = request.payload.uid;
console.log(uid);
connection.query('SELECT * FROM messages WHERE uid_fk = "' + uid + '"', function (error, results, fields) {
if (error) throw error;
console.log(results);
reply(results);
});
},
config: {
validate: {
payload: {
uid: Joi.number().integer()
}
}
}
});
欢迎来到堆栈溢出。这里关于代码的问题必须包括粘贴到问题中的相关代码,而不仅仅是通过外部链接提供。这是因为外部链接随着时间的推移会有消失或变化的习惯,使得您的问题对于未来找到它的人来说毫无价值。作为编程问题的长期参考是堆栈溢出的重要目标。因此,请将相关代码和错误消息直接粘贴到您的问题中并进行适当的格式化。 – jfriend00
另外,我们不希望链接到您遵循的某个教程。我们希望看到您的实际代码。 – jfriend00
@ZuluWar你能告诉我们你是怎么打这个POST api'/ message'的。 –