A tiny web framework written in Swift 2.0, built on top of GCDWebServer and GRMustache.
Honeymoon itself is heavily inspired by Flask. At this moment, Honeymoon provides these following APIs:
let app = Honeymoon()
app.get("/") { req in
return "Honeymoon started."
}
app.get("/list/<userId>") { req in
let userId = req.params!["userId"]!
return "list\(userId)"
}
app.get("/testTemplate") { req in
return app.renderTemplate("Test", data: ["name": "Chester","value": 10000, "taxed_value": 10000 - (10000 * 0.4), "in_ca": true])
}
app.post("/post") { req in
let c = req.form!["content"]!
return "Content: \(c)"
}
app.get("/testRedirect") { req in
return app.redirect("/target")
}
Currently there's a bug in Xcode when trying to use Swift framework in OS X command line application. So the example code is now in the tests.
Clone the project , use pod install
to install the dependencies. Open the generated xcworkspace
file and use Cmd + U
to run the test. Go to localhost:8000
and that's it.
The MIT License