Sha256: fe4335dd88382e6e671c23d4426f1b72c4bf6c84ae04ec330cc9651fb7743d79

Contents?: true

Size: 749 Bytes

Versions: 17

Compression:

Stored size: 749 Bytes

Contents

/**
 * Module dependencies.
 */

var connect = require('../');

var account = connect(function(req, res){
  var location = 'http://localhost:3000/account/' + req.headers.host.split('.localhost')[0];
  res.statusCode = 302;
  res.setHeader('Location', location);
  res.end('Moved to ' + location);
});

var blog = connect(function(req, res){
  res.end('blog app');
});

var main = connect(function(req, res){
  if (req.url == '/') return res.end('main app');
  if (0 == req.url.indexOf('/account/')) return res.end('viewing user account for ' + req.url.substring(9));
  res.statusCode = 404;
  res.end();
});

connect(
    connect.logger()
  , connect.vhost('blog.localhost', blog)
  , connect.vhost('*.localhost', account)
  , main
).listen(3000);

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/examples/vhost.js