我正在尝试将一个变量从html格式发送到hapi,但我认为我做错了。
addword.html:
<form id="messages" action="/addword" method="POST">
Your variable:
<br>
<input type="text" name="your_variable" value="your_value">
<br>
<input type="submit" value="Submit">
</form>
server.coffee
server.route
method: 'GET'
path: '/addword'
handler: (request, reply) ->
reply.file './public/addword.html'
###
ADD WORD
###
server.route
method: 'POST'
path: '/addword'
config: payload: output: 'data'
handler: (request, response) ->
your_variable = request.payload.your_variable
console.log your_variable
return
/server.js
/public/addword.html
我应该改变什么才能使它发挥作用?