Remove old doc directory
This commit is contained in:
@@ -1 +0,0 @@
|
||||
kapow route add -X POST /echo -c 'kapow get /request/body | kapow set /response/stream'
|
||||
@@ -1 +0,0 @@
|
||||
kapow route add -X POST /echo -c 'kapow get /request/body | kapow set /response/body'
|
||||
@@ -1 +0,0 @@
|
||||
kapow route add -X POST /greet -c 'who=$(kapow get /request/body | jq -r .name); kapow set /response/status 201; jq --arg value "${who:-World}" -n \{name:\$value\} | kapow set /response/body'
|
||||
@@ -1 +0,0 @@
|
||||
kapow route add /greet -c 'name=$(kapow get /request/params/name); echo Hello ${name:-World} | kapow set /response/body'
|
||||
@@ -1,6 +0,0 @@
|
||||
kapow route add /log_and_stuff - <<-'EOF'
|
||||
callback_url=$(kapow get /request/params/callback)
|
||||
echo this is a quite long sentence and other stuff | tee log.txt | kapow set /response/body
|
||||
echo sending to $callback_url | kapow set /response/body
|
||||
curl -X POST --data-binary @log.txt $callback_url | kapow set /response/body
|
||||
EOF
|
||||
@@ -1,4 +0,0 @@
|
||||
kapow route add /log_and_stuff - <<-'EOF'
|
||||
echo this is a quite long sentence and other stuff | tee log.txt | kapow set /response/body
|
||||
cat log.txt | kapow set /response/body
|
||||
EOF
|
||||
@@ -1,13 +0,0 @@
|
||||
Reading Headers
|
||||
===============
|
||||
|
||||
The HTTP protocol allows metadata using headers.
|
||||
|
||||
Kapow! allows you to read them easily:
|
||||
|
||||
|
||||
In this example, we read the header ``User-Agent`` and feed it
|
||||
to the response:
|
||||
.. code-block:: bash
|
||||
|
||||
kapow get /request/headers/User-Agent | kapow set /response/body
|
||||
@@ -1,12 +0,0 @@
|
||||
Redirecting a URL
|
||||
=================
|
||||
|
||||
The HTTP protocol allows queries to a URL to be redirected to other URL.
|
||||
|
||||
We can do them in Kapow! with little effort:
|
||||
|
||||
In this example, we read the header ``User-Agent`` and feed it to the response:
|
||||
.. code-block:: bash
|
||||
|
||||
kapow set /response/headers/Location 'http://example.org'
|
||||
kapow set /response/status 301
|
||||
@@ -1,16 +0,0 @@
|
||||
Working with Forms
|
||||
==================
|
||||
|
||||
When a browser submits a form to a server all the values included in the
|
||||
form are sent to the server in an HTTP call.
|
||||
|
||||
Kapow! handles the form decoding for you, the only thing you need to
|
||||
know is the **name** of the *field* or *fields*.
|
||||
|
||||
In this example we respond back with the content of the form field
|
||||
``myfield``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
kapow get /request/form/myfield | kapow set /response/body
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
Writing Headers
|
||||
===============
|
||||
|
||||
The HTTP protocol allows metadata using headers.
|
||||
|
||||
Kapow! allows you to set them easily:
|
||||
|
||||
|
||||
In this example, we respond by setting the ``Content-Type`` header
|
||||
to the value ``application/json``.
|
||||
.. code-block:: bash
|
||||
|
||||
kapow set /response/headers/Content-Type application/json
|
||||
|
||||
We could then return some JSON content:
|
||||
.. code-block:: bash
|
||||
|
||||
echo '{"data": "some relevant string"}' | kapow set /response/body
|
||||
Reference in New Issue
Block a user