Thursday 25 May 2017

Newbie - Connecting to a route

Hi, for development reasons, localhost:3000 will not work. So I will be using my ip, which I found through looking at the properties of my wifi.I tried connecting to the server with http://196.xxx.xx.x/, but it will not work. Yet http://localhost:3000/ will work fine.I assume that node.js is unable to listen to the ip adress, how would you tell node.js to do so?My code:app.js var express = require("express"); var app = express(); var jsonParser = require("body-parser").json; var routes = require("./routes.js"); var port = process.env.PORT || 3000; app.listen(port, '192.168.2.89',function(){ console.log("server is listening on port"); }); app.use('/', routes); routes.jsrouter.get("/", function(req, res){ database.Place.find({}, function(err, result){ res.json({result: result}); });

Submitted May 25, 2017 at 10:54PM by badboyzpwns

No comments:

Post a Comment