• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Holmusk/three-layer: Architecture of the Haskell web applications

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Holmusk/three-layer

开源软件地址(OpenSource Url):

https://github.com/Holmusk/three-layer

开源编程语言(OpenSource Language):

Haskell 93.0%

开源软件介绍(OpenSource Introduction):

Logo CircleCI

three-layer

This package is aimed at being a modern, production-level, batteries-included starting template for writing web servers with Haskell on backend and Elm on frontend. It follows the Three Layer Cake. architecture pattern.

Haskell libraries used in here:

Detailed approach description

This section contains more detailed description of the chosen architecture and our particular implementation of it.

Application environment

Data type for the runtime environment for the whole application is defined in the Lib/App/Env.hs module. It contains various fields required for the application processing, like database pool, JWT secret, logger, etc. It also has instance of custom Has typeclass which tells how to extract different parts of the application. This is done to achieve the following purposes:

  1. Specify in the constraints what parts of the environment you need.
  2. Introduce more modularity when multiple different environments are implemented.

Environment initialisation is happening in the Lib.hs module.

Application errors

Module Lib/App/Error.hs contains exhaustive list of all errors that application can throw. This module provides convenient layer between human-readable error names and HTTP error codes. It also contains useful utilities for throwing errors and for formatting CallStack of errors.

Application monad

Main application monad can be found in the Lib/App/Monad.hs module.

Database

This template uses PostgreSQL database and contains helper wrappers around functions from the postgresql-simple library to integrate smoother with our own monad. See Lib/Db/Functions.hs for more details.

Effects

All new effects (like sending an email. storing the file, etc.) should be added to the Lib/Effects/ directory.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap