|
1 #!/usr/bin/env node |
|
2 |
|
3 var http = require('http'), |
|
4 port = 8080, |
|
5 url = 'http://localhost:' + port + '/'; |
|
6 /* We can access nodejitsu enviroment variables from process.env */ |
|
7 /* Note: the SUBDOMAIN variable will always be defined for a nodejitsu app */ |
|
8 if(process.env.SUBDOMAIN){ |
|
9 url = 'http://' + process.env.SUBDOMAIN + '.jit.su/'; |
|
10 } |
|
11 |
|
12 http.createServer(function (req, res) { |
|
13 res.writeHead(200, {'Content-Type': 'text/plain'}); |
|
14 res.write('hello, I know nodejitsu.'); |
|
15 res.end(); |
|
16 }).listen(port); |
|
17 |
|
18 |
|
19 |
|
20 console.log('The http server has started at: ' + url); |