Kitura
public class Kitura
A set of helper functions to make it easier to create, start, and stop Kitura based servers.
-
Add an HTTPServer on a port with a delegate.
The server is only registered with the framework, it does not start listening on the port until Kitura.run() or Kitura.start() is called.
Parameter
Parameter onPort: The port to listen on.Parameter
Parameter with: TheServerDelegate
to use.Parameter
Parameter withSSL: ThesslConfig
to use.Returns
The createdHTTPServer
.Declaration
Swift
public class func addHTTPServer(onPort port: Int, with delegate: ServerDelegate, withSSL sslConfig: SSLConfig?=nil) -> HTTPServer
Parameters
onPort
The port to listen on.
with
The
ServerDelegate
to use.withSSL
The
sslConfig
to use.Return Value
The created
HTTPServer
. -
Add a FastCGIServer on a port with a delegate.
The server is only registered with the framework, it does not start listening on the port until Kitura.run() or Kitura.start() is called.
Parameter
Parameter onPort: The port to listen on.Parameter
Parameter with: TheServerDelegate
to use.Returns
The createdFastCGIServer
.Declaration
Swift
public class func addFastCGIServer(onPort port: Int, with delegate: ServerDelegate) -> FastCGIServer
Parameters
onPort
The port to listen on.
with
The
ServerDelegate
to use.Return Value
The created
FastCGIServer
. -
Start the Kitura framework.
Make all registered servers start listening on their port.
Note
This function never returns - it should be the last call in your main.swiftDeclaration
Swift
public class func run()
-
Start all registered servers and return
Make all registered servers start listening on their port.
Declaration
Swift
public class func start()
-
Stop all registered servers
Make all registered servers stop listening on their port.
Note
All of the registered servers are unregistered after they are stopped.Declaration
Swift
public class func stop()