Advertisement
Guest User

Untitled

a guest
Aug 19th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.41 KB | None | 0 0
  1. import spark.{Request, Response, Route}
  2. import spark.Spark._
  3.  
  4. object Main {
  5.   implicit def lambdaToRoute(lambda: (Request, Response) => AnyRef): Route =
  6.     new Route {
  7.       override def handle(request: Request, response: Response): AnyRef = lambda(request, response)
  8.     }
  9.  
  10.   def main(args: Array[String]): Unit = {
  11.     get("/hello", (req: Request, resp: Response) => {
  12.       "Hello, world"
  13.     })
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement