Skip to content

Instantly share code, notes, and snippets.

@matteocrippa
Created December 31, 2016 20:31
Show Gist options
  • Select an option

  • Save matteocrippa/3cc9c51df6b6f750c05f9e3864f48567 to your computer and use it in GitHub Desktop.

Select an option

Save matteocrippa/3cc9c51df6b6f750c05f9e3864f48567 to your computer and use it in GitHub Desktop.
Kitura Hello World
import Kitura
// Create a new router
let router = Router()
// Handle HTTP GET requests to /
router.get("/") {
request, response, next in
response.send("Hello, World!")
next()
}
// Add an HTTP server and connect it to the router
Kitura.addHTTPServer(onPort: 80, with: router)
// Start the Kitura runloop (this call never returns)
Kitura.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment