1

I developing loopback API and in one model called "payment" must listen xml post from another web app. I tried to make model hook on payment model to receive the xml post, but I confused how to accept xml file has been sent in my model hook?

allfix
  • 52
  • 1
  • 5

1 Answers1

1

LoopBack doesn't have built-in XML parsing at this point. But you can use an express route or middleware to handle the request, for example:

app.use('/my-xml-middleware', function(req, res, next) {
   // transform xml to json
   next();
});

Or:

app.post('/my-xml-service', function(req, res, next) {
  // process xml
  res.send(...);
});
Eric Alberson
  • 1,116
  • 1
  • 11
  • 23
Raymond Feng
  • 1,516
  • 9
  • 5