Zanzibar是一个扩展框架,用来构建配置驱动的Web应用。Zanzibar的目标是将应用开发简化成两步:
为应用和组件编写配置编写代码实现和测试业务逻辑Zanzibar将基于配置来生成样板和胶水代码。你只需要填充你的业务代码,Zanzibar就可以帮你生成一个可发布的应用。
Zanzibar内建的组件可以简化微服务和网关服务的开发。
Zanzibar的项目目录结构:
example-gateway#rootdirectory├──bin#directoryforgeneratedapplicationbinaries│ └──example-gateway#generatedexample-gatewaybinary├──build#directoryforallgeneratedcode│ ├──clients#generatedmocksandmoduleinitializersforclients│ ├──endpoints#generatedmocksandmoduleinitializersforendpoints│ ├──gen-code#generatedstructsand(de)serializersbyThriftcompiler│ ├──middlewares#generatedmoduleinitializersformiddlewares│ │└──default#generatedmoduleinitializersfordefaultmiddlewares│ └──services#generatedmocksandmoduleintialziersforservices├──build.yaml#configfileforZanzibarcodegeneration,seebelowfordetails├──clients#configdirectoryformodulesofclientmoduleclass│ └──bar#configdirectoryforaclientnamed'bar'├──config#configdirectoryforapplicationruntimeproperties│ ├──production.yaml#configfileforproductionenvironment│ └──test.yaml#configfilefortestenvironment├──copyright_header.txt#optionalcopyrightheaderforopensourceapplication├──endpoints#configdirectoryformodulesofendpointmoduleclass│ └──bar#configdirectoryforanendpointnamed'bar'├──idl#idldirectoryforallthriftfiles│ ├──clients#idldirectoryforclientthriftfiles│ └──endpoints#idldirectoryforendpointthriftfiles├──middlewares#configdirectoryformodulesofmiddlewaremoduleclass│ ├──transform-response#configdirectoryforamiddlewarenamed'transform-response'│ ├──default#directoryforalldefaultmiddlewares│ │└──log-publisher#configdirectoryforadefaultmiddlewarenamed'log-publisher'│ └──default.yaml#configfiledescribingdefaultmiddlewaresandtheirexecutionorder└──services#configdirectoryformodulesofservicemoduleclass└──example-gateway#configdirectoryforaservicenamed'example-gateway'
评论