Platform Swift Protocols CocoaPods Carthage Compatible

What is Swifter?

Tiny http server engine written in Swift programming language.

Branches

* stable – lands on CocoaPods and others. Supports the latest non-beta Xcode and SPM. Stable.

* master – stable branch plus experimental web-framework layer.

* 2.0 – next version of Swifter (async IO). Experimental.

How to start?

let server = HttpServer()
server["/hello"] = { .ok(.htmlBody("You asked for \($0)"))  }
server.start()

How to load HTML by string?

<div class="highlight highlight-source-swift position-relative" data-snippet-clipboard-copy-content="let server = HttpServer()
server[path] = { request in
return HttpResponse.ok(.text(""))
}
server.start()
“>

let server = HttpServer()
server[path] = { request in
    return HttpResponse.ok(.text("<html string>"))
}
server.start()