Відповідь 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
їх залежно від умов?
Відповіді:
3 для відповіді № 1Впевнений; Ви використовуєте Експрес, чи не так? 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"