8 if(process.env.SUBDOMAIN){ |
8 if(process.env.SUBDOMAIN){ |
9 url = 'http://' + process.env.SUBDOMAIN + '.jit.su/'; |
9 url = 'http://' + process.env.SUBDOMAIN + '.jit.su/'; |
10 } |
10 } |
11 |
11 |
12 http.createServer(function (req, res) { |
12 http.createServer(function (req, res) { |
13 res.writeHead(200, {'Content-Type': 'text/plain'}); |
13 var htmlcode = [ |
14 res.write('hello, I know nodejitsu.'); |
14 '<!DOCTYPE html>', |
|
15 '<html>', |
|
16 '<head>', |
|
17 '<script type="text/javascript">', |
|
18 'var CookieName = "TestCookie";', |
|
19 'document.cookie = CookieName+"=yes;";', |
|
20 'if(document.cookie.indexOf(CookieName) == -1) {', |
|
21 ' alert("Cookies are required but you’re blocking them.");', |
|
22 '}', |
|
23 '</script>', |
|
24 '</head>', |
|
25 '<body>', |
|
26 '<p>Placeholder for forthcoming crossdomain cookie examination.</p>', |
|
27 '<p>Pending approval from Nodejitsu [1] administrators.</p>', |
|
28 '<p>[1] <a href="http://opensource.nodejitsu.com/">', |
|
29 ' http://opensource.nodejitsu.com/</a></p>', |
|
30 '</body>', |
|
31 '</html>' |
|
32 ].join(''); |
|
33 |
|
34 res.writeHead(200, {'Content-Length': Buffer.byteLength(htmlcode, 'utf8'), |
|
35 'Content-Type': 'text/html;' |
|
36 }); |
|
37 res.write(htmlcode); |
15 res.end(); |
38 res.end(); |
16 }).listen(port); |
39 }).listen(port); |
17 |
40 |
18 |
|
19 |
|
20 console.log('The http server has started at: ' + url); |
41 console.log('The http server has started at: ' + url); |