No response when entering 'node server.js'
I am trying to write a simple TODO MEAN application with scotch.io instructions .
server.js has the following nodejs related code.
server.js
// set up ========================
var express = require('express');
var app = express(); // create our app w/ express
var mongoose = require('mongoose'); // mongoose for mongodb
var morgan = require('morgan'); // log requests to the console (express4)
var bodyParser = require('body-parser'); // pull information from HTML POST (express4)
var methodOverride = require('method-override'); // simulate DELETE and PUT (express4)
// configuration =================
mongoose.connect('mongodb://node:nodeuser@mongo.onmodulus.net:27017/uwO3mypu'); // connect to mongoDB database on modulus.io
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // parse application/json
app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json
app.use(methodOverride());
// listen (start app with node server.js) ======================================
app.listen(8080);
console.log("App listening on port 8080");
On an Ubuntu terminal, typing "node server.js" to start the server.
I am not getting an answer.
satyajit@Sunny:~/Documents/git repositories/mean-todo-app$ node server.js
satyajit@Sunny:~/Documents/git repositories/mean-todo-app$ node server.js
satyajit@Sunny:~/Documents/git repositories/mean-todo-app$ ls -l
total 16
drwxrwxr-x 7 satyajit satyajit 4096 Jun 28 11:03 node_modules
-rw-rw-rw- 1 satyajit satyajit 357 Jun 28 09:41 package.json
drwxrwxr-x 2 satyajit satyajit 4096 Jun 27 20:37 public
-rw-rw-rw- 1 satyajit satyajit 1455 Jun 28 09:41 server.js
Can anyone tell me where I am going wrong or am I missing everything there is to do?
source to share
as pointed out by Satyajit ubuntu uses nodejs server.js
.
Iโll just say that people sometimes get all sorts of problems because of this, as a lot of the modules you install will accept an executable for node.js is node
(not to talk about tutorials on the web).
to get better compatibility, I suggest you run this command:
sudo ln -s /usr/bin/nodejs /usr/bin/node
This will create a symbolic link for "node". Then you can use
node server.js
source to share