Skip to content

Instantly share code, notes, and snippets.

@kognate
Last active April 21, 2017 02:52
Show Gist options
  • Save kognate/4171c6b7b634683145cabade2dc61e3b to your computer and use it in GitHub Desktop.
Save kognate/4171c6b7b634683145cabade2dc61e3b to your computer and use it in GitHub Desktop.
import Kitura
import SwiftyJSON
// Create a new router
let router = Router()
router.all("/run", middleware: BodyParser())
router.post("/run") { request, response, next in
guard let parsedBody = request.body?.asJSON else {
next()
return
}
/**
* Your Code Goes Here
*/
next()
}
router.post("/info") {
_, response, next in
response.status(.OK).send(json: JSON([]))
}
// Add an HTTP server and connect it to the router
Kitura.addHTTPServer(onPort: 8080, 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