0.1.0 • Published 8 years ago
itineris v0.1.0
Version Router
Itineris (lat.) - route
Prerequisites
npm install -g ts-node
npm install -g typescriptEndpoints
Endpoints are NodeJS server instances, bind to IP and port according to its configuration
ts-node src/router-ctl.ts endpoint add --endpointName local
ts-node src/router-ctl.ts endpoint nodes add --endpointName local --nodeName local-node
ts-node src/router-ctl.ts endpoint node add --endpointName local --nodeName local-node --ip 0.0.0.0 --port 1111
ts-node src/router-ctl.ts endpoint set --endpointName test --tls-key key.pem --tls-cert cert.pem Targets
Targets are addresses where requests can be routed
ts-node src/router-ctl.ts target add --targetName test-target
ts-node src/router-ctl.ts target hosts add --targetName test-target --host localhost:1234Routers
ts-node src/router-ctl.ts route add --routeName test-route --endpointName test --order 1 --rule "
return 'test-target';
"To start router:
ts-node src/router-ctl.ts startRouter rule
Router rule is a javascript snippet that looks like a body of function with one argument req of type http.IncomingMessage
return req.headers['X-Api-Version'] === 1 ? 'target-1' : 'target-default';0.1.0
8 years ago