-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
51 lines (38 loc) · 1.63 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var fs = require('fs');
var path = require('path');
var http = require('http');
var express = require('express');
var reload = require('reload')
var bodyParser = require('body-parser')
var app = express();
app.use('/reveal.js', express.static(path.resolve(__dirname + '/reveal.js')));
app.use('/Font-Awesome', express.static(path.resolve(__dirname + '/node_modules/font-awesome')));
app.use('/slides', express.static(path.resolve(__dirname + '/slides')));
app.use('/reload', express.static(path.resolve(__dirname + '/node_modules/reload')));
app.use('/www', express.static(path.resolve(__dirname + '/www')));
// app.get('/', function (req, res) {
// res.send('Hello World!');
// });
var publicDir = path.join(__dirname, '')
app.set('port', process.env.PORT || 3000)
app.use(bodyParser.json()) //parses json, multi-part (file), url-encoded
app.get('/', function(req, res) {
res.sendFile(path.join(publicDir, 'index.html'))
})
var server = http.createServer(app)
//reload code here
//optional reload delay and wait argument can be given to reload, refer to [API](https://github.com/jprichardson/reload#api) below
// reload(server, app, [reloadDelay], [wait])
reload(server, app, 800, true)
server.listen(app.get('port'), function(){
console.log("Web server listening on port " + app.get('port'));
});
// app.use('/', express.static(path.resolve(__dirname)));
//
//
// var server = app.listen(3000, function () {
// var host = server.address().address;
// var port = server.address().port;
// console.log('Example app listening at http://localhost:%s', port);
// console.log('Reveal.js demo at: http://localhost:%s/reveal_demo.html', port);
// });