feat: returning some basic pages
This commit is contained in:
parent
d44a6a545d
commit
98d6f77014
|
@ -1,15 +1,45 @@
|
||||||
//> using dep com.lihaoyi::cask:0.9.1
|
//> using dep com.lihaoyi::cask:0.9.1
|
||||||
//> using dep com.softwaremill.quicklens::quicklens:1.9.4
|
//> using dep com.lihaoyi::scalatags:0.12.0
|
||||||
//> using dep com.lihaoyi::pprint:0.8.1
|
|
||||||
//> using dep org.scalameta::munit:1.0.0-M1
|
|
||||||
|
|
||||||
// import munit.FunSuite
|
// import munit.FunSuite
|
||||||
package app
|
package app
|
||||||
|
|
||||||
|
import scalatags.Text.all._
|
||||||
|
import scala.util.Random
|
||||||
|
|
||||||
object Main extends cask.MainRoutes {
|
object Main extends cask.MainRoutes {
|
||||||
@cask.get("/")
|
@cask.get("/")
|
||||||
def hello() = {
|
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")
|
@cask.post("/do-thing")
|
||||||
|
|
Loading…
Reference in New Issue