summaryrefslogblamecommitdiff
path: root/cask/test/src/test/cask/CaskTest.scala
blob: 5330dcec11e860b1ad93e45f24f90b24b08d7d66 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                 

                                            
                                    
                              
                                           


                     

                                                   
                          

   

                                                             
                                                       
              
                                 


              

 
                                       
package test.cask

import io.undertow.server.HttpServerExchange

object MyServer extends cask.Routes{
  @cask.get("/user/:userName")
  def showUserProfile(userName: String) = {
    s"User $userName"
  }

  @cask.get("/post/:postId")
  def showPost(postId: Int, query: Seq[String]) = {
    s"Post $postId $query"
  }

  @cask.get("/path/::subPath")
  def showSubpath(x: HttpServerExchange, subPath: String) = {
    val length = x.getInputStream.readAllBytes().length
    println(x)
    s"Subpath $subPath + $length"
  }

  initialize()
}

object Main extends cask.Main(MyServer)