zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.29k stars 3.96k forks source link

Can add a middleware that supports single routing #3548

Open xjl12322 opened 1 year ago

xjl12322 commented 1 year ago

So I need to split multiple routing groups. I just want to specify an interface under the same routing group that requires jwt verification. Other interfaces do not need to For example in the following example, I need the add, getById method jwt check。No other method is needed @server( prefix: book/v1 group: book ) service book-api{ jwt: JwtAuth @handler add post /add (AddBookReq) returns (AddBookResp) jwt: JwtAuth @handler getById get /get(GetBookByIdReq) returns (GetBookByIdResp) @handler getByIdList post /getIdList(GetBookByIdListReq) returns (GetBookByIdListResp)` }

kevwan commented 1 year ago

Sure, you can separate the jwt related routes from others in API file.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.