-1

enter image description hereenter image description hereI am referred the below link to use of Powerthesaurus-api.

https://www.npmjs.com/package/powerthesaurus-api

When I try the sample code, no data is outputted. What setup step am I missing?

I have done the obvious npm install but when I try a sample e.g "neck pain", getting only empty array. Help me to resolve it, Thanks.

Karthik.M
  • 67
  • 11

1 Answers1

0

I believe missing body-parser for express. Add

var bodyParser = require('body-parser')

as well as

app.use(bodyParser.json())

Express has added support for body-parser without installing an additional package

app.use(express.json({ limit: '10mb' }));

In order to get access to the post data we have to use body-parser . Basically what the body-parser is which allows express to read the body and then parse that into a Json object that we can understand.

Conrad Lotz
  • 8,200
  • 3
  • 23
  • 27