Created
July 26, 2016 22:59
-
-
Save jasonsilberman/426d7d84793eeedb66124a9b4ef59e17 to your computer and use it in GitHub Desktop.
Pseudo code for how I would like to write a server in Swift
This file contains 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
var server = Squid.Server() | |
var router = Squid.Router() | |
router.get('/login') { | |
return Authentication.Login(originalURL: $0.originalURL) | |
} | |
router.get('/post/:int') { | |
return Post.Single(postID: $1) // $1 has type of Int | |
} | |
server.use(router) | |
let logger = Squid.Logger() | |
server.use(logger) | |
server.start(port: 8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment