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