node.js - Unexpected token ILLEGAL using node javascript -


i trying execute command using node javascript, getting "uncaught syntaxerror: unexpected token illegal" in javascript.its on line 1.

var express = require('express');  var mongodb = require('mongodb');  var app = express();  var mongoclient = require('mongodb').mongoclient;  var db;  var port = process.env.port || 8080;    mongoclient.connect(mongo_host, function(err, database) {      if(err) throw err;      db = database;      app.listen(port, function () {          console.log('listening port' + port);      });  });    app.get('/', function (req, res) {      res.json({ message: 'bienvenue azure!' });  });    app.get('/plante', function (req, res) {      db.collection("plante").find().toarray(function(err, users) {          res.send(users);      });  });

nb: mongo_host git repository url connect azure

then showing following error:

syntaxerror: unexpected token illegal      @ exports.runinthiscontext (vm.js:53:16)      @ module._compile (module.js:404:25)      @ object.module._extensions..js (module.js:432:10)      @ module.load (module.js:356:32)      @ function.module._load (module.js:313:12)      @ function.module.runmain (module.js:457:10)      @ startup (node.js:138:18)      @ node.js:974:3

your semicolons aren't standard semicolons. \u037e (greek question mark). try switching them standard semicolons , running code.

someone has been reading twitter.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -