Monday, 29 May 2017

what worng in my code (node.js)

var express = require('express');
var path= require('path');
var bodyParser = require('body-parser');
var port =3000;
var index = require('./routes/index');
var tasks = require('./routes/tasks');
var app = express();
//View engine
app.set('views',path.join(__dirname,'views'));
app.set ('view engine','ejs');
app.engine ('html',require('ejs').renderFile);

//set static folder
app.use (express.static(path.join(__dirname,'client')));

//body parser MW
app.use (bodyParser.json());
app.use(bodyParser.urlencoded({extended:false}));
app.use('/',index);
app.use('/api',tasks);
app.listen(port,function() {
console.log('server started on port' + port);
});

someone can try help me ?i try to start my node server and i get this errors when i type in the console C:\sandbox\todolist>node server and i get this errors

SyntaxError: Unexpected token )
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\sandbox\todolist\server.js:5:13)



via shaked pas

No comments:

Post a Comment