Servant & Beam RealWorld 示例应用程序
一个 Servant 和 Beam 代码库,包含遵循 RealWorld 规范和 API 的真实示例(CRUD,auth,高级模式等)。
创建该代码库的目的是演示使用 Servant 和 Beam 构建的功能完善的全栈应用程序,其中包括 CRUD 操作、身份验证、路由、分页等。
我们已竭尽全力遵守Haskell社区风格指南和最佳实践。
有关如何与其他前端/后端一起使用的更多信息,请转到 RealWorld 存储库。
状态
但需要注意的是,授权头格式略有不同,所以这样做了:
┌─────────────────────────┬──────────┬──────────┐ │ │ executed │ failed │ ├─────────────────────────┼──────────┼──────────┤ │ iterations │ 1 │ 0 │ ├─────────────────────────┼──────────┼──────────┤ │ requests │ 31 │ 0 │ ├─────────────────────────┼──────────┼──────────┤ │ test-scripts │ 46 │ 0 │ ├─────────────────────────┼──────────┼──────────┤ │ prerequest-scripts │ 17 │ 0 │ ├─────────────────────────┼──────────┼──────────┤ │ assertions │ 280 │ 0 │ ├─────────────────────────┴──────────┴──────────┤ │ total run duration: 18s │ ├───────────────────────────────────────────────┤ │ total data received: 5.77KB (approx) │ ├───────────────────────────────────────────────┤ │ average response time: 25ms │ └───────────────────────────────────────────────┘
TODO
我对平均响应时间并不感到惊讶,这超过了 localhost ...使用非常空的表。
入门
使用 Nix 获取所需的所有 Haskell 软件包和应用程序依赖项。
$ nix-shell
从示例创建 .envrc 并允许内容
$ cp .envrc.example .envrc $ direnv allow
设置数据库。
$ database/scripts/setup
运行测试套件。
$ cabal new-test
您可以使用 ghcid 在监视模式下运行这些命令:
$ dev/watch-tests
可能看起来像这样:
运行 app。
$ cabal new-run exe:realworld-conduit
(The first version translated by vz on 2020.08.14)