curl - How to test a node.js server from command line -


i programming ios app needs use web service create authentication token. have written node.js server create token.

i know use curl test server locally command line can't seem work.

here snippet of server code

var app = express(); ....  app.post('/authenticate', function(req, res) {    // create token    ......     res.json({       identity_token: jws    }); });  var port = process.env.port || 3000; app.listen(port, function(err) {    if(err) throw err;            console.log('express server running on localhost:%d', port); }); 

i have tried using following curl command

curl -h "content-type: application/json" -x post -d '{"user_id":"user_id","nonce":"nonce"}' http://localhost/authenticate 

the error receive "failed connect localhost port 80: connection refused"

i appreciate or examples on how test server.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -