Compoxure example 应用说明

Compoxure 官方提供了一个demo应用,包含了cache,error,layout 等功能

环境准备

demo 使用docker-compose 运行

  • clone 代码
git clone https://github.com/tes/compoxure-example.git
 
  • 启动
docker-compose up -d
 
  • 效果

项目代码说明

  • 项目结构
  • proxy
    请求的入口,主要是进行proxy 项目配置以及后端server 的说明,默认是development 配置

    default 指定了那个服务是应用的入口
  • server app

    首页include的内容
  • layout 服务
  • 内容服务
  • docker-compose 文件
    内容很简单,就是定义服务的启动

说明

compoxure 的使用还 是很方便的,同时功能还是很全的,涉及了cache,异常处理,esi/ssi 的功能,同时也充分考虑到了云服务(cdn),
同时提供了layout 的功能,相比tailor 有好多新的扩展,比单独的使用esi/ssi 强大好多,对于html 解析的处理使用了httpparse2 而tailor 使用
了parse5,从官方性能的比较上httpparse2 更好点,有空了可以写一个集成web框架的demo(vue,react),同时官方的文档还是比较全的

参考资料

https://github.com/tes/compoxure
https://github.com/tes/compoxure-example

原文地址:https://www.cnblogs.com/rongfengliang/p/10155171.html