-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
51 lines (40 loc) · 1016 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var app,
dir,
express,
io,
port,
server,
_ref,
_ref1,
ignorePaths,
fs;
express = require('express');
fs = require('fs');
dir = "" + __dirname + "/.tmp";
port = (_ref = (_ref1 = process.env.PORT) != null ? _ref1 : process.argv.splice(2)[0]) != null ? _ref : 9000;
app = express();
server = require('http').createServer(app);
app.configure(function() {
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.errorHandler());
app.use(express["static"](dir));
app.use(app.router);
});
ignorePaths = [
'/listings', '/listings*',
'/market', '/market*',
'/account', '/account*',
'/login', '/login*'
];
app.get(ignorePaths, function (req, res) {
fs.readFile("" + dir + "/index.html", function (err, data) {
res.writeHead(200);
res.end(data);
});
});
module.exports = server;
module.exports.use = function() {
return app.use.apply(app, arguments);
};