Created
February 13, 2018 19:37
-
-
Save mczachurski/71e06e7a2f25bf4405fd64e775188bfd 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 PerfectHTTP | |
import PerfectHTTPServer | |
import PerfectLib | |
import Dip | |
// Configure dependency injection. | |
let container = DependencyContainer() | |
container.configure() | |
// Initialize all controllers. | |
let controllers = container.resolveAllControllers() | |
// Routes and handlers. | |
var routes = Routes() | |
routes.configure(basedOnControllers: controllers) | |
do { | |
// Launch the HTTP server. | |
try HTTPServer.launch( | |
.server(name: "www.example.ca", port: 8181, routes: routes)) | |
} 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