How can I respond in XML using ExpressJS?

后端 未结 2 1297
遥遥无期
遥遥无期 2020-12-13 18:44

I have a simple code that gives a JSON response for a specific route. Here\'s my current code:

var express = require(\'express\')
  , async = require(\'async         


        
2条回答
  •  自闭症患者
    2020-12-13 19:02

    As an update to this, it looks like res.type should be used instead as res.set does not give the same results.

    res.type('application/xml');
    

    More information can be found in the API reference.

提交回复
热议问题