summaryrefslogtreecommitdiff
path: root/cask/test
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-07-20 15:14:45 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-07-20 15:14:45 +0800
commit72e3be9c0076bd02df697b56f4f7a324cec1b377 (patch)
treec10bc1f6141b7fdd69f3ed9683368c616472c55e /cask/test
parentbb7dbd6a1b188f07b512057264177972d0dec850 (diff)
downloadcask-72e3be9c0076bd02df697b56f4f7a324cec1b377.tar.gz
cask-72e3be9c0076bd02df697b56f4f7a324cec1b377.tar.bz2
cask-72e3be9c0076bd02df697b56f4f7a324cec1b377.zip
get/post/put routes
Diffstat (limited to 'cask/test')
-rw-r--r--cask/test/src/test/cask/CaskTest.scala8
-rw-r--r--cask/test/src/test/cask/HelloWorld.scala12
2 files changed, 15 insertions, 5 deletions
diff --git a/cask/test/src/test/cask/CaskTest.scala b/cask/test/src/test/cask/CaskTest.scala
index 9a0876d..01c905a 100644
--- a/cask/test/src/test/cask/CaskTest.scala
+++ b/cask/test/src/test/cask/CaskTest.scala
@@ -1,19 +1,17 @@
package test.cask
object MyServer extends cask.Routes{
-
-
- @cask.route("/user/:userName")
+ @cask.get("/user/:userName")
def showUserProfile(userName: String) = {
s"User $userName"
}
- @cask.route("/post/:postId")
+ @cask.post("/post/:postId")
def showPost(postId: Int, query: String) = {
s"Post $postId $query"
}
- @cask.route("/path/::subPath")
+ @cask.put("/path/::subPath")
def showSubpath(subPath: String) = {
s"Subpath $subPath"
}
diff --git a/cask/test/src/test/cask/HelloWorld.scala b/cask/test/src/test/cask/HelloWorld.scala
new file mode 100644
index 0000000..69a4370
--- /dev/null
+++ b/cask/test/src/test/cask/HelloWorld.scala
@@ -0,0 +1,12 @@
+package test.cask
+
+object HelloRoutes extends cask.Routes{
+ @cask.get("/")
+ def hello() = {
+ "Hello World!"
+ }
+
+ initialize()
+}
+
+object HelloWorld extends cask.Main(HelloRoutes)