![Platform](https://img.shields.io/badge/Platform-Linux%20&%20OSX%20&%20tvOS-4BC51D.svg?style=flat)
![Swift](https://img.shields.io/badge/Swift-4.x-4BC51D.svg?style=flat)
![Protocols](https://img.shields.io/badge/Protocols-HTTP%201.1%20&%20WebSockets-4BC51D.svg?style=flat)
[![CocoaPods](https://img.shields.io/cocoapods/v/Swifter.svg?style=flat)](https://cocoapods.org/pods/Swifter)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
### What is Swifter?
Tiny http server engine written in [Swift](https://developer.apple.com/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?
```swift
let server = HttpServer()
server["/hello"] = { .ok(.html("You asked for \($0)")) }
server.start()
```
### How to share files?
```swift
let server = HttpServer()
server["/desktop/:path"] = shareFilesFromDirectory("/Users/me/Desktop")
server.start()
```
### How to redirect?
```swift
let server = HttpServer()
server["/redirect"] = { request in
return .movedPermanently("http://www.google.com")
}
server.start()
```
### How to HTML ?
```swift
let server = HttpServer()
server["/my_html"] = scopes {
html {
body {
h1 { inner = "hello" }
}
}
}
server.start()
```
### How to WebSockets ?
```swift
let server = HttpServer()
server["/websocket-echo"] = websocket(text: { session, text in
session.writeText(text)
}, binary: { session, binary in
session.writeBinary(binary)
})
server.start()
```
### CocoaPods? Yes.
```ruby
use_frameworks!
pod 'Swifter', '~> 1.4.5'
```
### Carthage? Also yes.
```
github "httpswift/swifter" ~> 1.4.5
```
### Swift Package Manager.
```swift
import PackageDescription
let package = Package(
name: "MyServer",
dependencies: [
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMajor(from: "1.4.5"))
]
)
```
### Docker.
```
docker run -d -p 9080:9080 -v `pwd`:/Swifter -w /Swifter --name Swifter swift bash -c "swift run"
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
记录iOS(Swift)开发中的一些知识点、小技巧.zip (328个子文件)
addshortcutsgif.gif 1.51MB
shadow_move.gif 396KB
TableViewRefreshAnimation2.gif 319KB
themeDemo.gif 311KB
tabbarAnimating.gif 198KB
changeStatusBarStyle2.gif 108KB
custom_actionsheet.gif 86KB
popOverView.gif 83KB
present_part_controller.gif 72KB
toast_view.gif 70KB
blink_scale_corner.gif 51KB
Pods-AddHomeShortcuts-umbrella.h 334B
Pods-SwiftTipsDemo-umbrella.h 328B
Swifter-umbrella.h 306B
shortcuts.html 3KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 2KB
Contents.json 405B
Contents.json 405B
Contents.json 370B
Contents.json 309B
Contents.json 307B
Contents.json 305B
Contents.json 303B
Contents.json 303B
Contents.json 302B
Contents.json 302B
Contents.json 63B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
Contents.json 62B
LICENSE 1KB
LICENSE 1KB
Manifest.lock 278B
Podfile.lock 278B
Manifest.lock 269B
Podfile.lock 269B
Pods-AddHomeShortcuts-dummy.m 146B
Pods-SwiftTipsDemo-dummy.m 140B
Swifter-dummy.m 118B
Pods-AddHomeShortcuts-acknowledgements.markdown 2KB
Pods-SwiftTipsDemo-acknowledgements.markdown 1KB
XcodeTips.md 6KB
README.md 2KB
Pods-AddHomeShortcuts.modulemap 132B
Pods-SwiftTipsDemo.modulemap 126B
Swifter.modulemap 104B
project.pbxproj 35KB
project.pbxproj 26KB
project.pbxproj 18KB
project.pbxproj 17KB
project.pbxproj 17KB
project.pbxproj 17KB
project.pbxproj 17KB
project.pbxproj 14KB
project.pbxproj 14KB
project.pbxproj 14KB
project.pbxproj 14KB
project.pbxproj 13KB
project.pbxproj 13KB
project.pbxproj 13KB
project.pbxproj 12KB
Swifter-prefix.pch 195B
Pods-AddHomeShortcuts-acknowledgements.plist 2KB
Pods-SwiftTipsDemo-acknowledgements.plist 2KB
Info.plist 2KB
Info.plist 2KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 1KB
Info.plist 828B
Info.plist 828B
共 328 条
- 1
- 2
- 3
- 4
资源评论
博士僧小星
- 粉丝: 1714
- 资源: 5876
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功