1

I have a URL like www.xxx.com/get-xml-content. I want to send an XML file as a response to this URL request.

<?xml version="1.0" encoding="UTF-8"?>
   <response>
      <playtext>I lov u</playtext>
   </response>

The XML I created will looks like above. I want to send this XML as a response to the given URL. How can it be possible in Node.js?

1 Answer 1

1

There are lots of libraries which can help you serve a xml as response. Here is one, which can help you

https://www.npmjs.com/package/xml

var xml = require('xml');

response.set('Content-Type', 'text/xml');
response.send(xml(yourobj));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.