servant-beam-realworld-example-app

由 Servant 和 Beam 支持的示例性全栈 Medium.com 克隆。「Exemplary fullstack Medium.com clone powered by Servant and Beam」

Github星跟踪图

Servant & Beam RealWorld 示例应用程序

一个 Servant 和 Beam 代码库,包含遵循 RealWorld 规范和 API 的真实示例(CRUD,auth,高级模式等)。

演示 RealWorld

创建该代码库的目的是演示使用 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)

概览

名称与所有者bradparker/servant-beam-realworld-example-app
主编程语言Haskell
编程语言Haskell (语言数: 4)
平台Linux, Mac, Windows
许可证BSD 3-Clause "New" or "Revised" License
发布数0
创建于2018-06-19 10:31:43
推送于2019-08-04 08:26:10
最后一次提交2019-03-31 11:21:13
星数33
关注者数4
派生数6
提交数105
已启用问题?
问题数2
打开的问题数1
拉请求数4
打开的拉请求数0
关闭的拉请求数0
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

RealWorld Example App

Build Status

A Servant and Beam codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

Demo RealWorld

This codebase was created to demonstrate a fully fledged fullstack application built with Servant and Beam including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Haskell community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Status

With the caveat that the Authorization header format is slightly different, this is done:

┌─────────────────────────┬──────────┬──────────┐
│                         │ 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

  • I'm not thrilled by that average response time, this is over localhost ... working with quite empty tables.

Getting started

  1. Use Nix to get all the Haskell package and application dependencies you need.
$ nix-shell
  1. Create .envrc from example and allow contents
$ cp .envrc.example .envrc
$ direnv allow
  1. Setup the database.
$ database/scripts/setup
  1. Run the test suite.
$ cabal new-test

You can run these in a watch mode using ghcid:

$ dev/watch-tests

Which might look something like this:

asciicast

  1. Run the app.
$ cabal new-run exe:realworld-conduit
去到顶部