From d2a858557e6c0c67099beb646116ad7abb857b2b Mon Sep 17 00:00:00 2001 From: Anton Kholomiov Date: Wed, 29 Nov 2023 10:31:29 +0300 Subject: [PATCH 1/2] Adds README files for examples --- examples/mig-example-apps/Counter/README.md | 3 ++ .../mig-example-apps/CounterClient/README.md | 4 +++ .../mig-example-apps/HelloClient/README.md | 3 ++ .../mig-example-apps/HelloWorld/README.md | 29 +++++++++++++++++++ examples/mig-example-apps/Html/README.md | 9 ++++++ .../mig-example-apps/HtmlTemplate/README.md | 9 ++++++ examples/mig-example-apps/JsonApi/README.md | 9 ++++++ examples/mig-example-apps/RouteArgs/README.md | 0 .../RouteArgsClient/README.md | 4 +++ 9 files changed, 70 insertions(+) create mode 100644 examples/mig-example-apps/Counter/README.md create mode 100644 examples/mig-example-apps/CounterClient/README.md create mode 100644 examples/mig-example-apps/HelloClient/README.md create mode 100644 examples/mig-example-apps/HelloWorld/README.md create mode 100644 examples/mig-example-apps/Html/README.md create mode 100644 examples/mig-example-apps/HtmlTemplate/README.md create mode 100644 examples/mig-example-apps/JsonApi/README.md create mode 100644 examples/mig-example-apps/RouteArgs/README.md create mode 100644 examples/mig-example-apps/RouteArgsClient/README.md diff --git a/examples/mig-example-apps/Counter/README.md b/examples/mig-example-apps/Counter/README.md new file mode 100644 index 0000000..43ff72a --- /dev/null +++ b/examples/mig-example-apps/Counter/README.md @@ -0,0 +1,3 @@ +# Counter + +An example on how to use Reader-pattern with the `mig` library. diff --git a/examples/mig-example-apps/CounterClient/README.md b/examples/mig-example-apps/CounterClient/README.md new file mode 100644 index 0000000..1595612 --- /dev/null +++ b/examples/mig-example-apps/CounterClient/README.md @@ -0,0 +1,4 @@ +# CounterClient + +An example on how to build client and server from the same code + diff --git a/examples/mig-example-apps/HelloClient/README.md b/examples/mig-example-apps/HelloClient/README.md new file mode 100644 index 0000000..32dfa6d --- /dev/null +++ b/examples/mig-example-apps/HelloClient/README.md @@ -0,0 +1,3 @@ +# Hello world server and client + +An example on how to build server and client from the same code. diff --git a/examples/mig-example-apps/HelloWorld/README.md b/examples/mig-example-apps/HelloWorld/README.md new file mode 100644 index 0000000..6bb8e03 --- /dev/null +++ b/examples/mig-example-apps/HelloWorld/README.md @@ -0,0 +1,29 @@ +# Hello wrold server + +An example of the most basic JSON API server +that has two routes. It can greet the user and say good bye. + +We can use `curl` to test it. +Run it with: + +``` +> stack run hello-world-mig-example-app +``` + +After server start we can test it with [Swagger UI](http://localhost:8085/swagger-ui/index.html). +Or with curl: + +Curl for hello route +``` +curl -X 'GET' \ + 'http://localhost:8085/api/v1/hello' \ + -H 'accept: application/json' +``` + +Curl for bye route + +``` +curl -X 'GET' \ + 'http://localhost:8085/api/v1/bye?user=alice' \ + -H 'accept: application/json' +``` diff --git a/examples/mig-example-apps/Html/README.md b/examples/mig-example-apps/Html/README.md new file mode 100644 index 0000000..0d80310 --- /dev/null +++ b/examples/mig-example-apps/Html/README.md @@ -0,0 +1,9 @@ +# Html + +A simple blog post site that servers HTML. +To run use: + +``` +> stack run html-mig-example-app + +``` diff --git a/examples/mig-example-apps/HtmlTemplate/README.md b/examples/mig-example-apps/HtmlTemplate/README.md new file mode 100644 index 0000000..ee10fd3 --- /dev/null +++ b/examples/mig-example-apps/HtmlTemplate/README.md @@ -0,0 +1,9 @@ +# HtmlTemplate + +A variation of `Html` example with safe URLs and HTML-templates based on mustache. + +To run use: + +``` +> stack run html-template-mig-example-app +``` diff --git a/examples/mig-example-apps/JsonApi/README.md b/examples/mig-example-apps/JsonApi/README.md new file mode 100644 index 0000000..9c2b26a --- /dev/null +++ b/examples/mig-example-apps/JsonApi/README.md @@ -0,0 +1,9 @@ +# JsonApi + +A weather forecast JSON API example. It shows how to build JSON API servers. + +To run use: + +``` +> stack run json-api-mig-example-app +``` diff --git a/examples/mig-example-apps/RouteArgs/README.md b/examples/mig-example-apps/RouteArgs/README.md new file mode 100644 index 0000000..e69de29 diff --git a/examples/mig-example-apps/RouteArgsClient/README.md b/examples/mig-example-apps/RouteArgsClient/README.md new file mode 100644 index 0000000..02012cd --- /dev/null +++ b/examples/mig-example-apps/RouteArgsClient/README.md @@ -0,0 +1,4 @@ +# RouteArgsClient + +Client with all sorts of inputs + From e80f550a39be98bd58283d1c2ed3de9161d4138b Mon Sep 17 00:00:00 2001 From: Anton Kholomiov Date: Wed, 29 Nov 2023 10:33:57 +0300 Subject: [PATCH 2/2] Add some testing links --- examples/mig-example-apps/Html/README.md | 2 +- examples/mig-example-apps/HtmlTemplate/README.md | 2 ++ examples/mig-example-apps/JsonApi/README.md | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/mig-example-apps/Html/README.md b/examples/mig-example-apps/Html/README.md index 0d80310..48cab90 100644 --- a/examples/mig-example-apps/Html/README.md +++ b/examples/mig-example-apps/Html/README.md @@ -5,5 +5,5 @@ To run use: ``` > stack run html-mig-example-app - ``` +After server start we can try it out in the browser. Go to [the main page](http://localhost:8085). diff --git a/examples/mig-example-apps/HtmlTemplate/README.md b/examples/mig-example-apps/HtmlTemplate/README.md index ee10fd3..8f43631 100644 --- a/examples/mig-example-apps/HtmlTemplate/README.md +++ b/examples/mig-example-apps/HtmlTemplate/README.md @@ -7,3 +7,5 @@ To run use: ``` > stack run html-template-mig-example-app ``` + +After server start we can try it out in the browser. Go to [the main page](http://localhost:8085). diff --git a/examples/mig-example-apps/JsonApi/README.md b/examples/mig-example-apps/JsonApi/README.md index 9c2b26a..0122b0c 100644 --- a/examples/mig-example-apps/JsonApi/README.md +++ b/examples/mig-example-apps/JsonApi/README.md @@ -7,3 +7,6 @@ To run use: ``` > stack run json-api-mig-example-app ``` + +After server start we can test it with [Swagger UI](http://localhost:8085/swagger-ui/index.html). +