knife-framework

Crates.ioknife-framework
lib.rsknife-framework
version0.1.7
sourcesrc
created_at2022-08-28 05:46:06.725529
updated_at2022-09-22 08:22:49.521358
descriptionKnife微服务框架
homepage
repositoryhttps://github.com/ocaso1987/knife-macro/
max_upload_size
id653728
size123,585
ocaso (ocaso1987)

documentation

README

knife-framework

Knife微服务框架

Crates.io GitHub Workflow Status (branch) docs.rs

框架介绍

本框架旨在构建一个类似于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.

Commit count: 0

cargo fmt