Express res.send() equivalent for Picker router?

What is the best way to handle do a res.send() with picker?

From what I can gather, it is only in express. But Picker is using an instance of NodeJS http.ServerResponse which I don’t think has a send() method.

Is there a simple way to return something?

I’m trying to build a webhook api and need to return a string of XML to the service to confirm my meteor app got the webhook.

This is the basic structure I use. Returning a string should be pretty straightforward.

Picker.route('/getData', function (params, request, response, next) {

  // Fire our response
  // You can set any headers here
  // response.setHeader('Access-Control-Allow-Origin', request.headers.origin);

  // Set your status
  response.statusCode = 200;

  // Send your response
  response.end('Got the data!');

});
1 Like

Perfect thanks dude this is great.

Also, if you find yourself parsing responses:

// Define our middleware using the Picker.middleware() method.
Picker.middleware(bodyParser.json());
Picker.middleware(bodyParser.urlencoded({
  extended: false
}));