c9

Running a Node.js app in c9:

Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

var port = process.env.PORT || 3000;
var ip = process.env.IP || '0.0.0.0';
var addr = `${ip}:${port}`;

app.listen(port, ip, function(){
  console.log(`Chat server listening at ${addr}`);
});

Para mas detalles véase c9 documentation: Run an Application.

Setting Up MongoDB in c9

MongoDB is preinstalled in your workspace. To run MongoDB, run the following below (passing the correct parameters to it). Mongodb data will be stored in the folder data.

$ mkdir data
$ echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"' > mongod
$ chmod a+x mongod

You can start mongodb by running the mongod script on your project root:

$ ./mongod

results matching ""

    No results matching ""