forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (29 loc) · 960 Bytes
/
server.js
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
// Dependencies
var express = require('express'),
app = express(),
bodyParser = require('body-parser'),
errorHandler = require('errorhandler'),
methodOverride = require('method-override'),
hostname = process.env.HOSTNAME || 'localhost',
port = parseInt(process.env.PORT, 10) || 8080,
publicDir = process.argv[2] || __dirname + '/public',
env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
// Config
app.use(express.static(publicDir));
app.use(errorHandler({
dumpExceptions: true,
showStack: true
}));
app.set('views', __dirname + '/public');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Routes
app.get('/', function(req, res) {
res.render('home/home');
});
app.get('/dashboard', function(req, res) {
res.render('dashboard/dashboard');
});
// Start Server
console.log('****** JAWS Server Running: http://%s:%s', hostname, port);
app.listen(port, hostname);