Skip to content

Commit 35b24b1

Browse files
authored
Add Http4s TodoMVC Example (#4446)
Closes #4433
1 parent 0c9acd0 commit 35b24b1

File tree

6 files changed

+660
-1
lines changed

6 files changed

+660
-1
lines changed

docs/modules/ROOT/pages/scalalib/web-examples.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ include::partial$example/scalalib/web/7-cross-platform-version-publishing.adoc[]
3939

4040
== Scala.js WebAssembly Example
4141

42-
include::partial$example/scalalib/web/8-wasm.adoc[]
42+
include::partial$example/scalalib/web/8-wasm.adoc[]
43+
44+
== TodoMVC http4s Web App
45+
46+
include::partial$example/scalalib/web/9-todo-http4s.adoc[]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package build
2+
import mill._, scalalib._
3+
4+
object `package` extends RootModule with ScalaModule {
5+
def scalaVersion = "2.13.8"
6+
def ivyDeps = Agg(
7+
ivy"org.http4s::http4s-ember-server::0.23.30",
8+
ivy"org.http4s::http4s-dsl::0.23.30",
9+
ivy"org.http4s::http4s-scalatags::0.25.2",
10+
ivy"io.circe::circe-generic::0.14.10"
11+
)
12+
13+
object test extends ScalaTests {
14+
def testFramework = "utest.runner.Framework"
15+
16+
def ivyDeps = Agg(
17+
ivy"com.lihaoyi::utest::0.8.5",
18+
ivy"org.typelevel::cats-effect-testing-utest::1.6.0",
19+
ivy"org.http4s::http4s-client::0.23.30"
20+
)
21+
}
22+
}
23+
24+
// This example demonstrates how to set up a simple Scala webserver
25+
// implementing the popular Todo-MVC demo application. It includes a test suite
26+
// that spins up the web server locally and makes HTTP requests against it.
27+
28+
/** Usage
29+
30+
> ./mill test
31+
+ webapp.WebAppTests.simpleRequest...
32+
33+
> ./mill runBackground
34+
35+
> curl http://localhost:8084
36+
...What needs to be done...
37+
...
38+
39+
> ./mill clean runBackground
40+
41+
*/

0 commit comments

Comments
 (0)