Last active
April 21, 2017 02:52
-
-
Save kognate/4171c6b7b634683145cabade2dc61e3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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