Calling node api through postman and response is enable javascript error

1,719 views
Skip to first unread message

Avinash Kadam

unread,
Aug 18, 2017, 3:57:06 AM8/18/17
to nodejs
When calling API https://mywebsite.com/api/register through browser and it returns correct response from server as
{ "error": false, "message": "Hello World" }
If we hit the same request from postman then it returns with some html content as Please enable JavaScript to view the page content.
Below is node side code:

var express = require("express");
var app = express();
var bodyParser = require("body-parser");
var router = express.Router();
var cors = require('cors');
app.use(cors());
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({ limit: '50mb', "extended": false }));
router.get("/", function (req, res) {
    res.json({
        "error": false, "message": "Hello World"
    });
});
app.use('/api', router);
app.listen(8990);

The api working through the browser but not with postman.
What will be the possible errors?
Please help. Thanks!

DaneiL

unread,
Aug 18, 2017, 4:55:27 PM8/18/17
to nod...@googlegroups.com
can u make a request using curl? does it return the expected result?

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/45f846b2-6c9d-4dbb-ae78-3f00272ec4ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
[]'s
Reply all
Reply to author
Forward
0 new messages