1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
var express = require('express'),
path = require('path'),
config = require('./config/config.js'),
fs = require('fs'),
os = require('os'),
shelljs = require('shelljs/global'),
PythonShell = require('python-shell')
var app = express();
var scriptPath = path.join(__dirname,'views/script');
//Set views property
app.set('views',path.join(__dirname,'views'));
//set Template engine
app.engine('html',require('hogan-express'));
//Set it as View engine
app.set('view engine','html');
//Set Static public folder
app.use(express.static(path.join(__dirname,'views')));
//Set Port to run the app
app.set('port',process.env.PORT||4000);
//Setting config
app.set('host',config.host);
//Socket IO
//Create server which listen app
var server = require('http').createServer(app);
//Socket.io is invoked by passing server
var io = require('socket.io')(server);
var exec = require('child_process').exec;
//Routing
require('./routes/routes.js')(express,app,io,fs,exec,os,PythonShell,scriptPath);
//Listen server
server.listen(app.get('port'),function(){
console.log('eSim Runing on port : '+app.get('port'));
})
|