Kotlin sources without setting your hair on fire. You can use `azs` to run Kotlin file like a script. Usage: az [options] available options: clean : clean output directory help : print help information compile : compile sources pack : compile sources and pack them to executable file upgrade : upgrade kotlin libraries upto last version list : print list of installed plugins version : show version jar : compile sources and pack them to jar
: Request({ karademo.views.home.Index() }) Get("/test") class Test() : Request({ TextResult("This is a test action, yo") }) Post("/updatebook") class Update() : Request({ redirect("/forms") }) } Controller
of pages using different template engines */ fun main(args: Array<String>) { var app = Express() app["title"] = "My Kotlin App" // available in the template as settings.title app["view engine"] = "ftl" // sets the default template engine app.get("/velocity", { req, res, next -> res.render("render.vm", hashMapOf( "name" to "Jon Nichols" )); }) app.get("/freemarker", { req, res, next -> res.render("render", hashMapOf( "name" to "Jon Nichols" )); }) app.listen(4000) } node.kt
2} //✔ object book { val title = "Title" val author = "Author" } book should match condition { title == "Title" } //✔ book should match condition { title == "Title" && author == "Author" } //✔ book should !match condition { title == "T" && author == "Author" } //✔ book should !match condition { title == "Title" && author == "Author" //✘ {throw NullPointerException()} should fail with NullPointerException() //✔ {1 should be equal 1} should !fail with AssertionError() //✔ {"string" should be equal "string"} should fail with AssertionError() //✘ mapOf(1 to "1", 2 to "2", 3 to "3") should contain key 1 //✔ mapOf(1 to 2, 2 to 3, 4 to 5) should contain key 2 //✔ mapOf(1 to 2, 2 to 3, 4 to 5) should contain key 3 //✘ katchers
calculator = Calculator() on("calling sum with two numbers") { val sum = calculator.sum(2, 4) it("should return the result of adding the first number to the second number") { shouldEqual(6, sum) } } } }} spek