Skip to content

Instantly share code, notes, and snippets.

Last active June 24, 2017 08:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
* Created by matsushitamasatsugu on 2016/05/04.
import spark.Request
import spark.Response
import spark.Spark.*
fun main(args: Array<String>) {
val c =Con("state")
//まあ、これでもいいきがするが。。。get("/hello",{req:Request, res:Response->c.hello(req,res)})
//参考 :
// kotlinのメソッド参照はレシーバの型までチェックしているからJava8のようにインスタンスメソッドそのまま渡せない。
fun <H> H.handlerFun(handle: H.(req:Request, res:Response)->Any) :(Request, Response)->Any
={req:Request, res:Response ->this.handle(req,res)}
* コントローラ
class Con(val msg :String){
fun hello(request:Request, respons: Response ):String{
return "Hello, world! $msg"
Copy link


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment