Crates.io | knife-framework |
lib.rs | knife-framework |
version | 0.1.7 |
source | src |
created_at | 2022-08-28 05:46:06.725529 |
updated_at | 2022-09-22 08:22:49.521358 |
description | Knife微服务框架 |
homepage | |
repository | https://github.com/ocaso1987/knife-macro/ |
max_upload_size | |
id | 653728 |
size | 123,585 |
Knife微服务框架
本框架旨在构建一个类似于SpringBoot的微服务框架,并支持对企业级配置注册等资源进行统一访问与管理。
说明文档请参考: 说明文档
use knife_framework::{
crates::hyper::{Body, Request, Response},
knife_router, knife_server,
util::{Result, OK},
};
#[knife_server(project = "knife", application = "knife-sample")]
fn main() {
}
#[knife_router(path = "/hello", method = "get")]
async fn handler(req: Request<Body>) -> Result<Response<Body>> {
OK(Response::new(Body::from("hello world")))
}
本框架依赖的组件大多均通过Reexport方式导出,无需另行依赖,但部分组件除外,需要另行引用,主要包括:
[dependencies]
knife-framework = "0.1.x"
serde = "1.0.144"
tracing = "0.1.36"
你可以克隆该项目,并且执行项目中示例: cargo run --example example_name.