Node.js:从不同文件发送XML响应
Node.js: Send XML response from different files
有如下XML响应:
app.post '/incoming', (req,res) ->
console.log "Hello, incoming call!"
message = req.body.Body
from = req.body.From
sys.log "From: " + from + ", Message: " + message
twiml = '<?xml version="1.0" encoding="UTF-8" ?>'n<Response>'n<Say>Thanks for your text, we''ll be in touch.</Say>'n</Response>'
res.send twiml, {'Content-Type':'text/xml'}, 200
我可以有不同的。XML
文件和res.send
文件视情况而定?
当然;你用的是快递,对吗?使用res.sendfile
:
app.post '/incoming', (req,res) ->
console.log "Hello, incoming call!"
message = req.body.Body
from = req.body.From
sys.log "From: " + from + ", Message: " + message
if condition
res.sendfile 'foo.xml'
else
res.sendfile 'bar.xml'
相关文章:
- 显示IIS上javascript文件(SOAP请求)的XML响应
- XMLHttpRequest获取请求xml响应
- dojo/request/iframe中读取xml响应的缺陷
- 跨域 Post 方法 ajax 调用使用 jQuery 和 XML 响应
- Angularjs - 使用 $http 获取 xml 响应而不是 json
- 哪个“控制器”在 JSON 中转换来自 .NET Web 服务的 XML 响应
- AJAX 检索 xml 响应
- sinon fakeserver 可以发送 xml 响应吗?
- 如何使用 jquery 通过函数解析 XML 响应
- 可以在ExtJS中将XML响应作为流读取吗
- 如何使用JspPage获取xml响应
- XHR纯XML响应类型
- IE9拒绝处理XML响应
- 来自thetvdb的Angular js和XML响应
- ExtJS 5中表单提交的XML响应出错
- 在ajax xml响应中正确检测数字数据
- 如何在JavaScript中解析API的XML响应
- 需要使用Javascript/JQuery使用Rest API XML响应
- 使用jquery获取跨站点XML响应
- Internet explorer截获XML响应