GithubHelp home page GithubHelp logo

api_prefix 怎么设置 about axum_admin HOT 4 CLOSED

lingdu1234 avatar lingdu1234 commented on August 27, 2024
api_prefix 怎么设置

from axum_admin.

Comments (4)

lingdu1234 avatar lingdu1234 commented on August 27, 2024

一般设置为API 版本号,或者随意一个名称吧,因为我这个有静态文件,/这个路由被静态文件暂用了,区分开就可以

from axum_admin.

lingdu1234 avatar lingdu1234 commented on August 27, 2024

我重新更新下 模板文件,太久没有更新,模板里面好多都没有

from axum_admin.

sunnyboy00 avatar sunnyboy00 commented on August 27, 2024

// .nest(&CFG.server.api_prefix, apps::api()) 更改为
.merge(apps::api())

另外就是 加api前缀

pub fn api() -> Router {
Router::new()
// 文件上传api
.nest(
&CFG.web.upload_url,
get_service(ServeDir::new(&CFG.web.upload_dir))
.handle_error(|error: std::io::Error| async move { (StatusCode::INTERNAL_SERVER_ERROR, for
at!("Unhandled internal error: {}", error)) }),
)
// 无需授权Api.通用模块
//.nest("/comm", no_auth_api())
.nest("/api/comm", no_auth_api())
// 系统管理模块
// .nest("/system", auth_api())
.nest("/api/system", auth_api())
// 测试模块
//.nest("/test", test_api())
.nest("/api/test", test_api())
}

from axum_admin.

lingdu1234 avatar lingdu1234 commented on August 27, 2024

我重新更新了 congfig sample 文件 api_prefix 需要前面加 "/" 像 “/api_v1” 这样的

from axum_admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.