Created
March 1, 2018 21:17
-
-
Save mczachurski/25878c4d263baef80558a0bafa2a4694 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
// Authorization. | |
var routesWithAuthorization = Routes() | |
routesWithAuthorization.configure(routesWithAuthorization: controllers) | |
let requestFilters: [(HTTPRequestFilter, HTTPFilterPriority)] = [ | |
(AuthenticationFilter(secret: configuration.secret, routesWithAuthorization: routesWithAuthorization), HTTPFilterPriority.high) | |
] | |
do { | |
// Launch the HTTP server. | |
try HTTPServer.launch( | |
.server( | |
name: configuration.serverName, | |
port: configuration.serverPort, | |
routes: allRoutes, | |
requestFilters: requestFilters | |
) | |
) | |
} catch { | |
fatalError("\(error)") // fatal error launching one of the servers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment