-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
executable file
·35 lines (26 loc) · 1004 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
33
34
35
var express = require("express");
var Syslog = require("node-syslog");
var app = express();
app.use(app.router); // you need this line so the .get etc. routes are run and if an error within, then the error is parsed to the ned middleware (your error reporter)
app.use(function(err, req, res, next) {
if(!err) return next(); // you also need this line
Syslog.init("node-syslog-test", Syslog.LOG_PID | Syslog.LOG_ODELAY, Syslog.LOG_LOCAL0);
Syslog.log(Syslog.LOG_ERR, err.stack);
Syslog.close();
});
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
app.get('/main', function (req, res) {
res.sendfile(__dirname + '/main/index.html');
});
app.get('/exu', function (req, res) {
res.sendfile(__dirname + '/exu_01.html');
});
app.get('/ogun', function (req, res) {
res.sendfile(__dirname + '/index2.html');
});
app.get('/*.(js|css|png|jpg|mp3|woff|ttf|gif|)', function(req, res){
res.sendfile(__dirname + '/assets'+req.url);
});
app.listen(80);