-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (26 loc) · 776 Bytes
/
app.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
33
34
35
36
var express = require('express'),
app = express(),
exphbs = require('express-handlebars');
app.use(express.static('./public'));
// use handlebars for templating
app.engine('.hbs', exphbs({
extname: '.hbs',
defaultLayout: 'paper'
})
);
app.set('view engine', '.hbs');
app.set('port', (process.env.PORT || 5000));
startServer(app, function(err){
if (err) throw err;
console.log('App ready...');
});
function startServer(app, callback){
var server = app.listen(app.get('port'), function(){
var host = server.address().address;
var port = server.address().port;
console.log('App listening at http://%s:%s', host, app.get('port'));
// route files from printOuts/index.js
require('./printOuts')(app);
require('./printOuts/route')(app);
});
}