Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

figome/itineris

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version Router

Itineris (lat.) - route

Prerequisites

npm install -g ts-node
npm install -g typescript

Endpoints

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:1234

Routers

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 start

Router 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';

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%