Deploying Kitura Swift App to IBM Bluemix
Mohammad Azam
71

Looks very good. I would make one change to dynamically check the port that Bluemix is using. Try replacing

```Kitura.addHTTPServer(onPort: 8080, with: router)```

with

```// Figure out what port we should listen on

let envVars = ProcessInfo.processInfo.environment

let portString = envVars[“PORT”] ?? envVars[“CF_INSTANCE_PORT”] ?? envVars[“VCAP_APP_PORT”] ?? “8090”

let port = Int(portString) ?? 8090

// Add HTTP Server to listen on the appropriate port

Kitura.addHTTPServer(onPort: port, with: router)```

Show your support

Clapping shows how much you appreciated Alec O'Connor’s story.