feat: returning some basic pages

This commit is contained in:
efim 2023-06-25 19:47:09 +00:00
parent d44a6a545d
commit 98d6f77014
1 changed files with 34 additions and 4 deletions

View File

@ -1,15 +1,45 @@
//> using dep com.lihaoyi::cask:0.9.1
//> using dep com.softwaremill.quicklens::quicklens:1.9.4
//> using dep com.lihaoyi::pprint:0.8.1
//> using dep org.scalameta::munit:1.0.0-M1
//> using dep com.lihaoyi::scalatags:0.12.0
// import munit.FunSuite
package app
import scalatags.Text.all._
import scala.util.Random
object Main extends cask.MainRoutes {
@cask.get("/")
def hello() = {
"Hello world!"
doctype("html")(
html(
head(
// title("Hello testing")
),
body(
div(
h1("This is it, the start"),
p("Let's keep going"),
ul(
Range(1, 15).map(index =>
li(a(s"article with number $index", href := s"/article/$index"))
)
)
)
)
)
)
}
@cask.get("/article/:id")
def articlePage(id: Long) = {
doctype("html")(
html(
body(
h1(s"Reading article $id"),
p(Random.nextString(100))
)
)
)
}
@cask.post("/do-thing")