-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
41 lines (36 loc) · 1.03 KB
/
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
33
34
35
36
37
38
39
40
41
var express = require('express')
, logger = require('morgan')
, app = express()
, jade = require('jade')
, template = jade.compileFile(__dirname + '/source/templates/homepage.jade')
, audioTemplate = jade.compileFile(__dirname + '/source/templates/audiopage.jade')
, socketVideoTemplate = jade.compileFile(__dirname + '/source/templates/socketvideo.jade')
app.use(logger('dev'))
app.use(express.static(__dirname + '/static'))
app.get('/', function (req, res, next) {
try {
var html = template({ title: 'Home' })
res.send(html)
} catch (e) {
next(e)
}
})
app.get('/audio', function (req, res, next) {
try {
var html = audioTemplate({ title: 'Audio' })
res.send(html)
} catch (e) {
next(e)
}
})
app.get('/socketvideo', function (req, res, next) {
try {
var html = socketVideoTemplate({ title: 'Socket Video' })
res.send(html)
} catch (e) {
next(e)
}
})
app.listen(process.env.PORT || 3000, function () {
console.log('Listening on http://localhost:' + (process.env.PORT || 3000))
})