Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Jan 4, 2024
1 parent d251252 commit 0b17c25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions example/queryParams/app/src/QueryParams.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app
object QueryParams extends cask.MainRoutes{

@cask.get("/article/:articleId") // Mandatory query param
@cask.get("/article/:articleId") // Mandatory query param, e.g. HOST/article/foo?param=bar
def getArticle(articleId: Int, param: String) = {
s"Article $articleId $param"
}
Expand All @@ -16,7 +16,7 @@ object QueryParams extends cask.MainRoutes{
s"Article $articleId $param"
}

@cask.get("/article4/:articleId") // 1-or-more query param
@cask.get("/article4/:articleId") // 1-or-more param, e.g. HOST/article/foo?param=bar&param=qux
def getArticleSeq(articleId: Int, param: Seq[String]) = {
s"Article $articleId $param"
}
Expand All @@ -26,7 +26,7 @@ object QueryParams extends cask.MainRoutes{
s"Article $articleId $param"
}

@cask.get("/user2/:userName") // allow unknown query params
@cask.get("/user2/:userName") // allow unknown params, e.g. HOST/article/foo?foo=bar&qux=baz
def getUserProfileAllowUnknown(userName: String, params: cask.QueryParams) = {
s"User $userName " + params.value
}
Expand Down
2 changes: 1 addition & 1 deletion example/variableRoutes/app/src/VariableRoutes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package app
object VariableRoutes extends cask.MainRoutes{
@cask.get("/user/:userName") // variable path segment
@cask.get("/user/:userName") // variable path segment, e.g. HOST/user/lihaoyi
def getUserProfile(userName: String) = {
s"User $userName"
}
Expand Down

0 comments on commit 0b17c25

Please sign in to comment.