A simple HTTP host router
... does what it's called: It routes HTTP request by their host.
- Wildcards and Regular Expressions
- Unmatching operator
- WebSocket support (HTTPS comming later)
- Full Express-integration (optional)
var router = require"host-router"express = require"express"http = require"http";// Raw function to handle requestresend"Hello World from a function!";// Express appvar app = express;appuse"/"ressend"This is express!";;// HTTP servervar server = httpcreateServerresend"HTTP, ok?";;// Do routingrouter// Simple usage & function"foobar.com": req// Wildcard & express".yolo.nl": app// Regular Expression & HTTP server"/some-regexp/": server80 // Port"localhost" // Host (optional)console.log"Up and running";;
Only works for
sub.foo.yolo.nl but not
A normal Regular Expression, e.g.
Just refer to this repository in some page like imprint, about or contact. Please.