-
-
Save pinceladasdaweb/11334293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HOPED-FOR BEHAVIOR: /cats says: Cats Home | |
// ACTUAL BEHAVIOR: /cats says: Main Wildcard | |
var express = require('express'); | |
var app = express(); | |
app.get('/', function(req, res) { | |
res.send('Main Home'); | |
}) | |
var catsApp = express(); | |
catsApp.get('/', function(req, res) { | |
res.send('Cats Home'); | |
}) | |
app.use('/cats', catsApp); | |
app.get('/*', function(req, res) { | |
res.send('Main Wildcard'); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Post here: http://justjs.com/posts/creating-reusable-express-modules-with-their-own-routes-views-and-static-assets
Other gist here: https://gist.github.com/boutell/4423473