···5050}
5151```
52525353-# Documentation
5353+# Learning Wisp
54545555The Wisp examples are a good place to start. They cover various scenarios and
5656include comments and tests.
+121-5
docs/index.html
···11<!DOCTYPE html>
22<html lang="en">
33+34<head>
45 <meta charset="UTF-8">
56 <meta name="viewport" content="width=device-width, initial-scale=1.0">
66- <title>Wisp - A practical Gleam web framework</title>
77+ <title>Wisp - A practical web framework for Gleam</title>
78 <link rel="stylesheet" href="style.css">
89</head>
1010+911<body>
1010- <img class="hero-wordmark" src="./images/wordmark.svg" alt="Wisp">
1111- <nav>
1212- <a href="https://github.com/lpil/wisp">GitHub</a>
1313- </nav>
1212+ <section class="home-hero">
1313+ <nav>
1414+ <a href="https://github.com/lpil/wisp">Source & Guides</a>
1515+ <a href="https://hexdocs.pm/wisp">API Docs</a>
1616+ <a href="https://github.com/sponsors/lpil">Sponsor</a>
1717+ </nav>
1818+ <img src="./images/wordmark.svg" alt="Wisp">
1919+ <p>
2020+ A practical web framework for Gleam
2121+ </p>
2222+ </section>
2323+2424+ <ul class="content-width features">
2525+ <li>
2626+2727+ <h2>
2828+ Perfectly productive
2929+ </h2>
3030+ <p>
3131+ Wisp is simple, type safe, and entirely free from confusing magic. Make
3232+ development as stress-free as possible whether you're starting a new
3333+ prototype or maintaining a large system.
3434+ </p>
3535+ </li>
3636+3737+ <li>
3838+ <h2>
3939+ Flipping fast
4040+ </h2>
4141+ <p>
4242+ Thanks to the Mist HTTP server and the mighty multithreaded BEAM
4343+ runtime Wisp applications are fast, even at the 99th percentile during a
4444+ big burst of traffic. In benchmarks Wisp can outperform Go, NodeJS, and
4545+ Elixir Phoenix + Cowboy.
4646+ </p>
4747+ </li>
4848+4949+ <li>
5050+ <h2>
5151+ Totally testable
5252+ </h2>
5353+ <p>
5454+ If your application matters then you're going to want to test it. A Wisp
5555+ web application is as easy to test as any regular Gleam function, and an
5656+ assortment of useful test helpers are provided to keep your tests
5757+ concise.
5858+ </p>
5959+ </li>
6060+6161+ <li>
6262+ <h2>
6363+ Really reliable
6464+ </h2>
6565+ <p>
6666+ Scrambling to fix problems in production is stressful, so Wisp uses
6767+ Gleam's type safety and the BEAM's fault tolerance help prevent those
6868+ panicked late night phone calls from your boss.
6969+ </p>
7070+ </li>
7171+ </ul>
7272+7373+ <section class="content-width">
7474+ <h2>OK, but what does Wisp actually give you?</h2>
7575+ <ul>
7676+ <li>Composable middleware, with lots of useful ones built-in.</li>
7777+ <li>Type safe routing with good old fashioned pattern matching.</li>
7878+ <li>Parsing of JSON, urlencoded, and multipart bodies.</li>
7979+ <li>Tamper-proof signed cookies, suitable for authentication.</li>
8080+ <li>Body size limiting and file upload streaming to disc, to prevent
8181+ memory exhaustion attacks.</li>
8282+ <li>Serving of CSS, JavaScript, or whatever other static assets you want.</li>
8383+ <li>Logging, both ad-hoc logging and request logging, using a middleware.</li>
8484+ <li>Regular Gleam programming, so you can use any Gleam package you want
8585+ without trouble.</li>
8686+ </ul>
8787+ <p>
8888+ And a recommended project structure, so you can focus on solving the
8989+ problems you want to solve, rather than reinventing the wheel.
9090+ </p>
9191+ </section>
9292+9393+ <section class="content-width">
9494+ <h2>That sounds good! What does it look like?</h2>
9595+ <p>
9696+ Here's a JSON API request handler that saves an item in a database.
9797+ </p>
9898+ <pre><code>import my_app/people
9999+import my_app/web.{Context}
100100+import gleam/result.{try}
101101+import wisp.{Request, Response}
102102+103103+pub fn handle_request(req: Request, ctx: Context) -> Response {
104104+ use json <- wisp.require_json(req)
105105+106106+ let result = {
107107+ use params <- try(people.parse_params(json))
108108+ use person <- try(people.save(params, ctx.db))
109109+ Ok(people.to_json(person))
110110+ }
111111+112112+ case result {
113113+ Ok(body) -> wisp.json_response(body, 201)
114114+ Error(_) -> wisp.bad_request()
115115+ }
116116+}
117117+</code></pre>
118118+119119+ <p>
120120+ Want to learn more? Check out <a href="https://github.com/lpil/wisp#learning-wisp">
121121+ the Wisp guides</a>.
122122+ </p>
123123+ </section>
124124+125125+ <footer>
126126+ 🧚
127127+ <a href="https://github.com/gleam-lang/gleam/blob/main/CODE_OF_CONDUCT.md">Code of conduct</a>
128128+ </footer>
14129</body>
130130+15131</html>
···11name = "wisp"
22version = "0.4.0"
33gleam = ">= 0.30.0"
44-description = "A fun and practical web framework for Gleam"
44+description = "A practical web framework for Gleam"
55licences = ["Apache-2.0"]
6677repository = { type = "github", user = "lpil", repo = "wisp" }