powerthesaurus-api getting empty array as output

47 Views Asked by At

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.

1

There are 1 best solutions below

2
Conrad Lotz On

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.