Daniil  Yasnov
Daniil Yasnov

Reputation: 31

How can I send JS string as xml document to user in Express.js?

I can't save string buffer as file and send it, because I'm using elastic beanstalk. I just have a string and I need to user can download this as xml document.

router.get('/', (req, res) => {
  let xml = `<note>
                <to>Tove</to>
                <from>Jani</from>
                <heading>Reminder</heading>
                <body>Don't forget me this weekend!</body>
            </note>`;
  //What next?
});

Upvotes: 0

Views: 385

Answers (1)

Keval
Keval

Reputation: 3336

Add content disposition header as attachment and content type as xml

Content-Disposition: attachment

Upvotes: 1

Related Questions