Glen Swift Glen Swift - 1 year ago 205
Node.js Question

restify's body parser is not working for some reason

I don't understand why this works:


but this doesn't work:

instance.use((req, res, next) => {

Answer Source

use expects an argument of the form function (req, res, next). Therefore, when the first example works correctly, restify.bodyParser() is a function of this form. Hence, you will need pass req, res, next in the second example.

instance.use((req, res, next) => {
  restify.bodyParser()(req, res, next);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download