URL에 전달 PARAMS 읽고 다음 Node.js를 응용 프로그램에서Node.js를 : 나는 내 서버에 POST 요청을 할 레일에서
response = Typhoeus::Request.post("http://url.localtunnel.com/request?from=ola&to=ole")
result = JSON.parse(response.body)
를, 내가 읽고 싶은 From
및 To
:
app.post '/request', (req,res) ->
console.log "I have received a request, sweet!!"
sys.log req.params.from
#sys.log "From: " + req.from + ", To: " + req.to + ", Id: " + req.id
어떻게해야합니까?
감사
바로, Express의 'params'는 정의한 경로에서 파싱됩니다. 'app.get ('/ user/: id', ...'는'req.param.id'를 주며'req.query'를 원한다. 또는 'POST'요청. –