基于金字塔的minty http api服务器
minty-pyramid的Python项目详细描述
金字塔配置库minty python(micro)服务。
入门
视图:
def hello(request): # See minty package for more information about these domain classes: domain_query_instance = request.get_query_instance("YourDomainHere") return domain_query_instance.some_domain_query()
主要:
def main(*args, **kwargs): # See minty package for more information about these domain classes: loader = minty_pyramid.Engine(domains=[YourDomainHere]) # [optional] To retrieve session information, make sure to add before # running loader.setup() kwargs["session_manager"] = True # Ensure the "get_query_instance" request method is available # It will use a CQRS instance, built with an InstanceConfig built from # the configuration file specified in the file pointed to by # "minty_service.infrastructure.config_file" in kwargs config = loader.setup(*args, **kwargs) config.add_route("hello_world", "/hello") config.add_view( hello, request_method="GET", renderer="json", route_name="hello_world" ) # If you've created the app from an openapi-spec file make sure to add: routes.add_routes(config) # Returns a WSGI application return loader.main()
- 代码生成命令:
- 生成视图:使用“生成视图”命令创建样板视图。
从openapi(v3)规范文件运行创建应用程序时 “generate views”为所有视图创建带有样板代码的“views.py”文件 在OpenAPI规范中指定。
有关详细信息,请参见“生成视图–帮助”
- 生成路由:使用“生成路由”命令创建路由。
从OpenAPI规范文件生成或重新生成“routes.py”文件。
有关详细信息,请参见“生成路线–帮助”
更多文档
有关此操作的详细信息,请参阅通过CI生成的文档 模块以及如何在我们的在线文档中做出贡献打开index.html 当你到达那里: https://gitlab.com/minty-python/minty-pyramid/-/jobs/artifacts/master/browse/tmp/docs?job=qa
贡献
请阅读CONTRIBUTING.md 有关我们的行为准则以及向我们提交请求的过程的详细信息。
版本控制
我们使用SemVer进行版本控制。对于版本 可用,请参阅 tags on this repository