Vapor 3.0.0 正式发布,Swift 的 Web 框架和服务器

  

Vapor 3.0.0 已正式发布,这是一个重大改变的版本,3.0 对 Vapor 及其所有相关软件包进行了彻底的重写。

3.0 有三个重要的新功能:

  • Async:Vapor 现在完全没有阻塞,并且可以在 Apple 的 SwiftNIO 上运行。 这意味着 Vapor 3 可以在您的应用程序需要时处理高级的并发情况

  • Services:JSON 配置文件已失效。由于 Vapor 新的依赖注入框架服务,现在一切都是 Swift

  • Codable:由于 Codable 集成在所有 Vapor 中,因此从 HTTP 消息解析和序列化内容、创建数据库模型以及渲染视图现在更安全,更高效

其他一些变化:

New:

  • Logger.reportError(...) is now public.

  • New convenience methods for encoding Content with status/headers (#1587).

  • AbortError now supports adding headers (#1397).

Fixed:

  • All APIs are now documented with doc blocks.

  • API surface minimized (everything made internal that can be).

  • HEAD requests are now properly handled (#1617).

  • ContentContainer is now more powerful (#1648).

  • map / flatMap now support implicit return types (#1606).

  • FileMiddleware is now non-blocking (#1586).

  • Bind to port 8080 even in production (#1455).

  • Tons of other small bug fixes and improvements.

更多更新内容请查看:https://medium.com/@codevapor/vapor-3-0-0-released-8356fa619a5d  
源码下载:https://github.com/vapor/vapor/releases/tag/3.0.0

Vapor 是一个 Swift 的 Web 开发框架,其灵感来自于 Laravel/Lumen 。支持 iOS、OS X 和 Ubuntu 系统。

特点:

  • 快速

  • 语法漂亮

  • 类型安全

示例代码:

Route.get("cookie") { request in
    let response = Response(status: .OK, text: "Cookie was set")
    response.cookies["test"] = "123"
    return response
}

猜你喜欢

转载自www.oschina.net/news/95822/vapor-3-0-0-released