Skip to content
Implements the ServerDelegate protocol for Titan, allowing usage of Titan with Kitura's server.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
Sources/TitanKituraAdapter
Tests
.dockerignore
.gitignore
.swiftlint.yml
Dockerfile
LICENSE.txt
Package.swift
README.md

README.md

TitanKituraAdapter

Implements the ServerDelegate protocol for Titan, allowing usage of Titan with Kitura's server.

Getting started

TitanKituraAdapter depends on Kitura-net, the engine that powers Kitura, so you don't really need to do much besides importing this package. Here's a simple example in your main.swift

import Titan
import TitanKituraAdapter

let titanApp = Titan()

titanApp.get("/") {
  return "Hello world"
}

TitanKituraAdapter.serve(titanApp.app, on: 8000)

or if you're using the Titan top level sugar:

import Titan
import TitanKituraAdapter

get("/") {
  return "Hello world"
}

TitanKituraAdapter.serve(TitanApp, on: 8000)

How?

Kitura's webserver interacts with an application through the ServerDelegate protocol. TitanKituraAdapter implements a TitanServerDelegate which conforms to this protocol. The serve function is only a few lines long and does pretty much the same thing that Kitura's main interface does.

You can’t perform that action at this time.