commit b3f65ae13f7b535ae1ec7e1e4c408cc04b5ced09
parent 4a7653f195251864e6a2c3a03c65d286e9cece1d
Author: Joris Vink <joris@coders.se>
Date: Mon, 4 Aug 2014 19:02:23 +0200
Add a readme to parameters + update some text
Diffstat:
examples/parameters/README.md | 14 ++++++++++++++
examples/parameters/conf/parameters.conf | 4 ++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/examples/parameters/README.md b/examples/parameters/README.md
@@ -0,0 +1,14 @@
+Example on how to handle GET/POST parameters in Kore.
+
+Run:
+```
+ # kore run
+```
+
+Test:
+```
+ # curl -i -k https://127.0.0.1:8888/?id=123123
+```
+
+The output will differ based on wether or not id is a valid
+u_int16_t number or not. (the string should always be present).
diff --git a/examples/parameters/conf/parameters.conf b/examples/parameters/conf/parameters.conf
@@ -17,6 +17,10 @@ domain 127.0.0.1 {
static / page
# The parameters allowed for "/" (GET method).
+ #
+ # If you would want to declare parameters available
+ # to the page handler for POST, swap the 'get' setting
+ # to 'post' instead, Kore takes care of the rest.
params get / {
# Validate the id parameter with the v_id validator.
validate id v_id