-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new dsl to describe api design #23
Comments
|
|
|
|
|
|
|
%> cat site_v1.m2
//mir:syntax v0.1-alpha.1
package v1
message ArticleReq {
Content string `json:"content"`
}
message ArticleRes {
Code int `json:"code"`
Msg string `json:"msg"`
PostId string `json:"postid"`
}
// Site v1 service
service Site(group: v1) {
Index() `get:"/index/"`
Articles() `get:"/articles/:category/"`
Category() `get:"/category/"`
PostArticle(article ArticleReq) ArticleRes `post:"/articles/:category/"`
} %> cat common.m2
//mir:syntax v0.1-alpha.1
package core
message ArticleReq {
Content string `json:"content"`
}
message ArticleRes {
Code int `json:"code"`
Msg string `json:"msg"`
PostId string `json:"postid"`
}
message IndexHead {
LastTime string `param:"lastTime"`
} %> cat site_v2.m2
//mir:syntax v0.1-alpha.1
package v2
import core
// Site v2 service
service Site(group: v2, chain: _) {
Index(param core.indexParam) `get:"/index"`
Articles() `get, post:"/articles/:category/"`
Category() `get:"/category/"`
PostArticle(article core.ArticleReq) core.ArticleRes `post:"/articles/:category/"`
} |
确定使用 Thrift IDL 来定义RESTful接口。详情参看 #43. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: