How can I respond in XML using ExpressJS?

You can use any number of the XML libraries available on npm. Here’s an example using the simply-named “xml” library:

var xml = require('xml');

response.set('Content-Type', 'text/xml');
response.send(xml(name_of_restaurants));

See the module’s documentation for a description of how it converts JavaScript objects to XML. If you need things returned in a specific XML format, you’ll have more work to do, of course.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)