Warning
Be aware that if you register more than one route with exactly the same path, only the first route added will be used.
Defining a route:
$ kapow route add /my/route -c 'echo hello world | kapow set /response/body'
Calling route:
$ curl http://localhost:8080/my/route
hello world
Defining a route:
$ kapow route add -X POST /echo -c 'kapow get /request/body | kapow set /response/body'
Calling a route:
$ curl -d 'hello world' -X POST http://localhost:8080/echo
hello world
Defining a route:
$ kapow route add '/echo/{message}' -c 'kapow get /request/matches/message | kapow set /response/body'
Calling a route:
$ curl http://localhost:8080/echo/hello%20world
hello world
You can list the active routes in the Kapow! server.
$ kapow route list
[{"id":"20c98328-0b82-11ea-90a8-784f434dfbe2","method":"GET","url_pattern":"/echo/{message}","entrypoint":"/bin/sh -c","command":"kapow get /request/matches/message | kapow set /response/body"}]
Or, if you want human-readable output, you can use :program:`jq`:
$ kapow route list | jq
[
{
"id": "20c98328-0b82-11ea-90a8-784f434dfbe2",
"method": "GET",
"url_pattern": "/echo/{message}",
"entrypoint": "/bin/sh -c",
"command": "kapow get /request/matches/message | kapow set /response/body",
}
]
Note
Kapow! has a :ref:`http-control-interface`, bound by default to
localhost:8081
.
You need the ID of a route to delete it. Running the command used in the :ref:`listing routes example <listing-routes-example>`, you can obtain the ID of the route, and then delete it by typing:
$ kapow route remove 20c98328-0b82-11ea-90a8-784f434dfbe2