|
|
%!s(int64=11) %!d(string=hai) anos | |
|---|---|---|
| Common | %!s(int64=11) %!d(string=hai) anos | |
| Resources | %!s(int64=11) %!d(string=hai) anos | |
| Swifter | %!s(int64=11) %!d(string=hai) anos | |
| Swifter.xcodeproj | %!s(int64=11) %!d(string=hai) anos | |
| SwifterOSX | %!s(int64=11) %!d(string=hai) anos | |
| .gitignore | %!s(int64=11) %!d(string=hai) anos | |
| LICENSE | %!s(int64=12) %!d(string=hai) anos | |
| README.md | %!s(int64=11) %!d(string=hai) anos | |
| github.png | %!s(int64=12) %!d(string=hai) anos | |
| github_code.png | %!s(int64=12) %!d(string=hai) anos |
Tiny http server engine written in Swift ( https://developer.apple.com/swift/ ) programming language.
How to start ?
let server = HttpServer()
server["/hello"] = { .OK(.HTML("You asked for " + $0.url)) }
How to share files ?
if let publicDir = publicDir {
server["/home/(.+)"] = HttpHandlers.directory("~/")
}
How to redirect ?
server["/redirect"] = { request in
return .MovedPermanently("http://www.google.com")
}