Permalink
Newer
100644
44 lines (38 sloc)
1.55 KB
1
/**
2
* Simple node.js server, which generates the synax highlighted version of itself
3
* using the Ace modes and themes on the server and serving a static web page.
4
*/
14
var highlighter = require("../../lib/ace/ext/static_highlight");
15
var JavaScriptMode = require("../../lib/ace/mode/javascript").Mode;
16
var theme = require("../../lib/ace/theme/twilight");
17
18
var port = process.env.PORT || 2222;
19
20
http.createServer(function(req, res) {
21
var url = req.url;
22
var path = /[^#?\x00]*/.exec(url)[0];
23
var root = resolve(__dirname + "/../../").replace(/\\/g, "/");
24
path = resolve(root + "/" + path).replace(/\\/g, "/");
25
if (path.indexOf(root + "/") != 0)
26
path = __filename;
33
res.end(
34
'<html><body>\n' +
35
'<style type="text/css" media="screen">\n' +
36
highlighted.css +
37
'</style>\n' +