V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kevinwan
V2EX  ›  推广

我们这样定义 api,大家觉得如何?

  •  1
     
  •   kevinwan · 2020-11-19 13:48:56 +08:00 · 2051 次点击
    这是一个创建于 1226 天前的主题,其中的信息可能已经有所发展或是发生改变。
    type Request {
    	Name string `path:"name"`
    }
    
    type Response {
    	Message string `json:"message"`
    }
    
    service greet-api {
    	@handler NoResponseHandler
    	get /greet/to/:name
    	
    	@handler RemoveHandler
    	delete /greet/remove/:name(Request)
    	
    	@handler NoRequestHandler
    	put /greet/talk returns (Response)
    	
    	@handler NormalHandler
    	post /greet/from/:name(Request) returns (Response)
    }
    
    3 条回复    2020-11-24 15:35:26 +08:00
    DoctorCat
        1
    DoctorCat  
       2020-11-22 20:19:35 +08:00
    看着觉得累,不知为何。 话说怎么跟 swagger 结合呢
    kevinwan
        2
    kevinwan  
    OP
       2020-11-24 08:12:26 +08:00 via iPhone
    @DoctorCat 我们不用 swagger🤩
    DoctorCat
        3
    DoctorCat  
       2020-11-24 15:35:26 +08:00
    @kevinwan 那求教,用啥做文档化了?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5427 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 08:52 · PVG 16:52 · LAX 01:52 · JFK 04:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.