Documentation ¶
Overview ¶
Package server provides a sample HTTP/Websocket server which registers itself in consul using one or more url prefixes to demonstrate and test the automatic fabio routing table update.
During startup the server performs the following steps:
- Add a handler for each prefix which provides a unique response for that instance and endpoint
- Add a `/health` handler for the consul health check
- Register the service in consul with the listen address, a health check under the given name and with one `urlprefix-` tag per prefix
- Install a signal handler to deregister the service on exit
If the protocol is set to "ws" the registered endpoints function as websocket echo servers.
Example:
# http server ./server -addr 127.0.0.1:5000 -name svc-a -prefix /foo,/bar ./server -addr 127.0.0.1:5001 -name svc-b -prefix /baz,/bar # websocket server ./server -addr 127.0.0.1:6000 -name ws-a -prefix /echo1,/echo2 -proto ws
Click to show internal directories.
Click to hide internal directories.