【文件属性】:
文件名称:SampleRestAPI
文件大小:3.56MB
文件格式:ZIP
更新时间:2021-04-19 10:14:36
Go
###这是示例RESTful API,用于操作简单的计数器
为了运行该应用程序,您必须安装运行的docker和docker-compose
使用以下命令构建和运行该应用程序:
make up # this invokes docker-compose which installs the server and the database
该服务器始于localhost:8000 ,并准备接收请求。 在此处查看OpenAPI规范: ://app.swaggerhub.com/apis/Handkock/SampleRestAPI/1.0.0
该项目包含三个主要部分:
main.go-调用服务器,初始化计数器和清除终止的主入口点
app.go-运行服务器并处理请求
counter.go-计数器模型,它负责数据库交互并处理计数器操作
【文件预览】:
SampleRestAPI-main
----api()
--------openapi.yml(1KB)
----.gitignore(4B)
----go.mod(247B)
----db()
--------Dockerfile(105B)
--------docker-entrypoint-initdb.d()
----main_test.go(3KB)
----go.sum(10KB)
----docker-compose.yml(584B)
----app.go(2KB)
----main.go(1KB)
----README.md(791B)
----RestAPI(6.78MB)
----.env.development(177B)
----makefile(186B)
----counter.go(1KB)