From 3b12936933b27d215da40666143e94df2f3d1ef5 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Wed, 3 Apr 2024 02:26:50 +0200 Subject: [PATCH 1/2] Change command for running example to `cabal run` --- README.md | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a4e2cef..deda3be 100644 --- a/README.md +++ b/README.md @@ -23,31 +23,21 @@ As for the name: Sinatra + Warp = Scotty. ## Examples -Run /basic.hs to see Scotty in action: +Run `examples/basic.hs` to see Scotty in action (if you haven't, run `cabal update` first): -```bash -runghc examples/basic.hs ``` -`Setting phasers to stun... (port 3000) (ctrl-c to quit)` - -Or equivalently with [`stack`](https://docs.haskellstack.org/en/stable/): - -```bash -stack exec -- scotty-basic +$ cabal run scotty-basic +Setting phasers to stun... (port 3000) (ctrl-c to quit) ``` -Once the server is running you can interact with it with curl or a browser: +Once the server is running you can interact with it with `curl` or a browser: -```bash -curl localhost:3000 ``` -`foobar` - -```bash -curl localhost:3000/foo_query?p=42 +$ curl localhost:3000 +foobar +$ curl localhost:3000/foo_query?p=42 +

42

``` -`

42

` - Additionally, the `examples` directory shows a number of concrete use cases, e.g. @@ -58,6 +48,8 @@ Additionally, the `examples` directory shows a number of concrete use cases, e.g * [file upload](./examples/upload.hs) * and more +You can run these using `cabal run scotty-exceptions`, `cabal run scotty-globalstate` etc. + ## More Information Tutorials and related projects can be found in the [Scotty wiki](https://github.com/scotty-web/scotty/wiki). From b3166378006bf266660a149041fc72c971a80c21 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Thu, 11 Apr 2024 00:39:01 +0200 Subject: [PATCH 2/2] Reformat readme code blocks to allow single-click copying --- README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index deda3be..05217a4 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,26 @@ As for the name: Sinatra + Warp = Scotty. Run `examples/basic.hs` to see Scotty in action (if you haven't, run `cabal update` first): +```bash +cabal run scotty-basic ``` -$ cabal run scotty-basic -Setting phasers to stun... (port 3000) (ctrl-c to quit) -``` + +`Setting phasers to stun... (port 3000) (ctrl-c to quit)` Once the server is running you can interact with it with `curl` or a browser: +```bash +curl localhost:3000 ``` -$ curl localhost:3000 -foobar -$ curl localhost:3000/foo_query?p=42 -

42

+ +`foobar` + +```bash +curl localhost:3000/foo_query?p=42 ``` +`

42

` + Additionally, the `examples` directory shows a number of concrete use cases, e.g. * [exception handling](./examples/exceptions.hs)