使用expressjs将post请求中的表单输入注入get请求中

injecting form input from a post request into a get request using expressjs

本文关键字:请求 输入 注入 get 表单 post expressjs 使用      更新时间:2024-03-26

我想从表单中获取表单输入,并使用expressjs将其注入到get请求中。不太确定怎么做。我做了一个plnkr。我真的不希望答案指向正确的方向,所以读一些资料会很好。

[enter code here][1]

我会使用查询字符串来传递您需要的数据。

.post('/', function(res,req){ 
    res.redirect('/?data=' + req.body.data); 
})
.post('/', function(rgvfbbgbvbves,req){
    req.body  // this will give you all of the relevant POST
    // this is where i need help i think 
    res.redirect('/'); 
})