Created
July 7, 2015 23:35
-
-
Save hyeomans/10dd1ff76f424deeca64 to your computer and use it in GitHub Desktop.
Using regex to obtain language from url
This file contains hidden or 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
var express = require('express') | |
, app = express(); | |
app.get(/\/?(\w{2}-\w{2})?\/details/gi, function(req, res) { | |
res.send('Hola mundo from:', req.params[0]); | |
}); | |
var server = app.listen(3000, function () { | |
var host = server.address().address; | |
var port = server.address().port; | |
console.log('Listening at http://%s:%s', host, port) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment