Skip to content

Commit

Permalink
Merge pull request #80 from anton-k/update-docs
Browse files Browse the repository at this point in the history
Docs for HTML goodies
  • Loading branch information
anton-k authored Nov 26, 2023
2 parents f29ea38 + 43e67a3 commit b4f6152
Show file tree
Hide file tree
Showing 5 changed files with 521 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v2.1

Adds some HTML goodies:

* cookies (new input `Cookie` and function to set the cookies)
* type safe stable URLs from server definition
* example `HtmlTemplate` on how to use template engine with library

Adds stack template to create new hello-world server with stack.

## v2

The servers are augmented with info on API structure. It allows us to
Expand Down
26 changes: 25 additions & 1 deletion docs/src/00-foreword.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,31 @@ bye :: Query "user" Text -> Get (Resp Text)
bye (Query name) = pure $ ok ("Goodbye " <> name)
```

## How to install library
## How to start a new project

If you are a Haskell beginner and interested to try out building servers with `mig`
the easiest way to start is to install [`stack`](https://docs.haskellstack.org/en/stable/).
See the main page of the `stack` docs in the link on how to do it. After the `stack` is installed we can generate a
new `mig` project that contains hello world server with command:

```bash
> stack new my-project-name anton-k/hello-mig
```

It generates `my-project-name` directory that contains a code for our server.
Let's navigate to it, build server code and start the server:

```bash
> cd my-project-name
> make build
> make run
```

After that we can query the server on port 8085 either by curl or by swagger-ui.
The project contains a basic JSON API server with two routes. The code will be explained
in detail in the next chapter of this tutorial.

## How to use mig library in your project

We can install it from hackage.
We need to use the library [mig-server](https://hackage.haskell.org/package/mig-server)
Expand Down
Loading

0 comments on commit b4f6152

Please sign in to comment.