LocoSwitch is a kind of tiny reverse proxy.
First, start LocoSwitch:
./loco-switch
the default HTTP port of LocoSwitch is
8080
For example, you started several HTTP services on various port:
http://localhost:8888
http://localhost:6666
To register the two services, use this:
curl -X POST http://localhost:8080/admin/functions/register \
-H 'Content-Type: application/json; charset=utf-8' \
-d @- << EOF
{
"name":"hello_go",
"revision":"default",
"httpPort":8888,
"status":0,
"https":false,
"domain":"localhost",
"endpoint":""
}
EOF
curl -X POST http://localhost:8080/admin/functions/register \
-H 'Content-Type: application/json; charset=utf-8' \
-d @- << EOF
{
"name":"hello_js",
"revision":"default",
"httpPort":6666,
"status":0,
"https":false,
"domain":"localhost",
"endpoint":""
}
EOF
curl -X POST -d 'John Doe' http://localhost:8080/functions/hello_go
curl -X POST -d 'Bob Morane' http://localhost:8080/functions/hello_js
🚧 this is a work in progress
🚧 this is a work in progress