diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-07-20 08:48:05 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-07-20 08:48:05 +0800 |
commit | 37bfff46d2d875d2dec27a24973ec8f6784f1bfb (patch) | |
tree | f2d13a4d13bdc9b0a7bddaf6ab6b31e6debe60a2 /cask/test/src/test/cask/CaskTest.scala | |
download | cask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.tar.gz cask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.tar.bz2 cask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.zip |
first commit
Diffstat (limited to 'cask/test/src/test/cask/CaskTest.scala')
-rw-r--r-- | cask/test/src/test/cask/CaskTest.scala | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cask/test/src/test/cask/CaskTest.scala b/cask/test/src/test/cask/CaskTest.scala new file mode 100644 index 0000000..a1384f8 --- /dev/null +++ b/cask/test/src/test/cask/CaskTest.scala @@ -0,0 +1,34 @@ +package test.cask + + +object MyServer extends cask.Server(){ + + def x = "/ext" + @cask.route("/user/:username" + (x * 2)) + def showUserProfile(userName: String) = { + // show the user profile for that user + s"User $userName" + } + + @cask.route("/post/:int") + def showPost(postId: Int) = { + // show the post with the given id, the id is an integer + s"Post $postId" + } + + @cask.route("/path/:subPath") + def show_subpath(subPath: String) = { + // show the subpath after /path/ + s"Subpath $subPath" + } + + initialize() + println(routes.value) +} + +object Main extends cask.Main(MyServer){ + def main(args: Array[String]): Unit = { + MyServer + } +} + |