bin/server

changeset 0
14388e456fdf
child 1
5f43030d87fe
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bin/server	Mon Dec 22 23:02:08 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +#!/usr/bin/env node
     1.5 +
     1.6 +var http = require('http'),
     1.7 +    port = 8080,
     1.8 +     url = 'http://localhost:' + port + '/';
     1.9 +/* We can access nodejitsu enviroment variables from process.env */
    1.10 +/* Note: the SUBDOMAIN variable will always be defined for a nodejitsu app */
    1.11 +if(process.env.SUBDOMAIN){
    1.12 +  url = 'http://' + process.env.SUBDOMAIN + '.jit.su/';
    1.13 +}
    1.14 +
    1.15 +http.createServer(function (req, res) {
    1.16 +  res.writeHead(200, {'Content-Type': 'text/plain'});
    1.17 +  res.write('hello, I know nodejitsu.');
    1.18 +  res.end();
    1.19 +}).listen(port);
    1.20 +
    1.21 +
    1.22 +
    1.23 +console.log('The http server has started at: ' + url);

mercurial