[英]How to display the URL data in a POST Request using Express, Javascript & Handlebars?
How would I go about utilizing a POST
request to display the URL
data like a GET
request? 我将如何利用
POST
请求像GET
请求一样显示URL
数据? For example I'm trying to have the URL
" http://localhost:8000/requestPost?hello=goodbye&numbers=123 " print the following list - 例如,我正在尝试使
URL
“ http:// localhost:8000 / requestPost?hello = goodbye&numbers = 123 ”打印以下列表-
How would I go about getting access to the URL
variables with a POST
? 我将如何通过
POST
访问URL
变量? I'm using Express & Handlebars. 我正在使用Express&Handlebars。
You would do it the same way as you would for a get request: 您将执行与获取请求相同的方法:
var express = require('express');
var app = express();
app.post('/requestPost', function(req, res){
res.send('hello: ' + req.query.hello + ' numbers: ' + req.query.numbers);
});
app.listen(3000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.