Add more guides

This commit is contained in:
Rashad Gover 2022-09-12 01:57:14 +00:00
parent dbee24a597
commit a904740764
6 changed files with 15 additions and 11 deletions

View File

@ -11,8 +11,6 @@ const codeLanguage = 'haskell'
const code =
`module Main where
import Data.Text
import Data.Function
import Okapi
-- | Run a web server on port 3000 that responds to GET requests of the form:
@ -20,13 +18,13 @@ import Okapi
main :: IO ()
main = run id $ do
methodGET
pathParam @Text \`is\` "greet"
pathParam \`is\` "greet"
maybeName <- optional $ pathParam <|> queryParam "name"
pathEnd
let greeting = case maybeName of
Nothing -> "Hello there."
Just name -> "Hello, " <> name <> "."
ok & setPlainText greeting & return`
return $ setJSON greeting $ ok`
const tabs = [
{ name: 'Main.hs', isActive: true },

View File

@ -29,6 +29,7 @@ const navigation = [
{
title: 'Guides',
links: [
{ title: 'Authentication', href: '/docs/authentication' },
{ title: 'Route patterns', href: '/docs/route-patterns' },
{ title: 'Middleware', href: '/docs/middleware' },
{ title: 'Testing', href: '/docs/testing' },

View File

@ -83,6 +83,3 @@ pong = do
```
In many cases, we can apply algebraic properties like the distributive property to simplify our parsers.

View File

@ -0,0 +1,6 @@
---
title: Authentication
description: A guide on authentication in Okapi.
---
Coming soon

View File

@ -6,6 +6,8 @@ description: A guide on integrating Okapi with a Servant application.
Okapi and Servant make a great combo. Since Okapi is built directly on top of [wai](https://hackage.haskell.org/package/wai),
you can embed your Okapi application into Servant easily. Here's how.
---
1. Define your Servant API type and handlers as usual:
```haskell

View File

@ -8,13 +8,13 @@ Learn how to get Okapi set up in your project and start building for the Web. {%
{% quick-links %}
{% quick-link title="Installation" icon="installation" href="/" description="Step-by-step guides to setting up your system and installing the library." /%}
{% quick-link title="Project setup" icon="installation" href="/#project-setup" description="Step-by-step guides to using Okapi in your latest Haskell project." /%}
{% quick-link title="Todo App Tutorial" icon="presets" href="/" description="Learn how to use Okapi by building a simple todo app." /%}
{% quick-link title="Todo App Tutorial" icon="presets" href="/docs/todo-app" description="Learn how to use Okapi by building a simple todo app." /%}
{% quick-link title="WAI Integration" icon="plugins" href="/" description="Use Okapi with any web framework that's built on WAI." /%}
{% quick-link title="Servant integration" icon="plugins" href="/servant-integration" description="Use Okapi with your Servant API easily." /%}
{% quick-link title="Learn Haskell" icon="theming" href="/" description="New to Haskell? Take our official Haskell course before learning Okapi." /%}
{% quick-link title="Learn Haskell" icon="theming" href="/intro-to-haskell" description="New to Haskell? Take our official Haskell course before learning Okapi." /%}
{% /quick-links %}