Skip to content

Instantly share code, notes, and snippets.

@jasonsilberman
Created July 26, 2016 22:59
Show Gist options
  • Save jasonsilberman/426d7d84793eeedb66124a9b4ef59e17 to your computer and use it in GitHub Desktop.
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
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