Skip to content
Myr

index.js

This file

Path

examples/vhost/index.js

47 lines · 915 bytes · JavaScript

Last changed by

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

History of this file

Take it

The walk stopped after 200 commits: lines older than 916acd1 point at it.

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 1–5why, one step back
1/**
2 * Module dependencies.3 */45var express = require('../..');

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

line 6why, one step back
6var logger = require('morgan');

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 7–8why, one step back
7
8/*

Merge pull request #1598 from colynb/patch-1TJ Holowaychukbefore adoption028d9d8

line 9why, one step back
9edit /etc/hosts:

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 10–15why, one step back
10
11127.0.0.1 foo.example.com12127.0.0.1 bar.example.com13127.0.0.1 example.com14*/15

Merge pull request #1634 from joshlangner/patch-1TJ Holowaychukbefore adoptione59a882

line 16why, one step back
16// Main server app

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 17–19why, one step back
17
18var main = express();19

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

line 20why, one step back
20main.use(logger('dev'));

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 21–26why, one step back
21
22main.get('/', function(req, res){23 res.send('Hello from main app!')24});2526main.get('/:sub', function(req, res){

Merge pull request #1659 from dresende/patch-1Jonathan Ongbefore adoptionb66c7da

line 27why, one step back
27 res.send('requested ' + req.params.sub);

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 28–38why, one step back
28});
2930// Redirect app3132var redirect = express();3334redirect.all('*', function(req, res){35 console.log(req.subdomains);36 res.redirect('http://example.com:3000/' + req.subdomains[0]);37});38

Merge pull request #1634 from joshlangner/patch-1TJ Holowaychukbefore adoptione59a882

line 39why, one step back
39// Vhost app

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 40–42why, one step back
40
41var app = express();42

Merge pull request #1634 from joshlangner/patch-1TJ Holowaychukbefore adoptione59a882

lines 43–44why, one step back
43app.use(express.vhost('*.example.com', redirect)) // Serves all subdomains via Redirect app
44app.use(express.vhost('example.com', main)); // Serves top level domain via Main server app

replace 0.6.x travis with 0.10.xTJ Holowaychukbefore adoption916acd1

lines 45–47why, one step back
45
46app.listen(3000);47console.log('Express app started on port 3000');