猿:JSON请求响应的处理程序

时间:2021-02-16 20:44:21
【文件属性】:
文件名称:猿:JSON请求响应的处理程序
文件大小:4KB
文件格式:ZIP
更新时间:2021-02-16 20:44:21
golang json rest-api handler Go 猿 Ape提供了一个处理程序,该处理程序封装了JSON格式的HTTP响应管理。 package main import ( "github.com/agusmunioz/ape" "github.com/gorilla/mux" "log" "net/http" ) type Article struct { Id string `json:"id"` Title string `json:"title"` } //GetArticles returns business objects in an ape response, no json encoding is need it. func GetArticles ( r * http. Request ) ape. Response { articles := [] Article {
【文件预览】:
ape-master
----go.mod(32B)
----response.go(2KB)
----handler.go(959B)
----response_test.go(4KB)
----handler_test.go(3KB)
----README.md(772B)
----.gitignore(6B)

网友评论