-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
48 lines (31 loc) · 1008 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
/*jslint node: true, nomen:true */
"use strict";
var http = require('http');
var fs = require('fs');
var addstyle;
http.createServer(function (req, res) {
if (req.url === "/favicon.ico") {
res.end("404");
} else {
var params = req.url.replace("/", "").split("-"),
current = 0,
styles = "";
addstyle = function (stylenumber) {
if (stylenumber < params.length) {
fs.readFile(__dirname + "/" + params[current] + ".css", "utf-8", function (err, data) {
if (err) {
current += 1;
addstyle(current);
} else {
current += 1;
styles += "\n" + data;
addstyle(current);
}
});
} else {
res.end(styles);
}
};
addstyle(current);
}
}).listen(5555, '0.0.0.0');