Sign inSign up

relaxed/go-api

By relaxed

•Updated over 5 years ago

Image
0

203

relaxed/go-api repository overview

Build Status codecov

⁠go-api template

Quickly create an echo-based api project

⁠Getting Started

⁠set env

GOPROXY https://goproxy.cn⁠

⁠Create a new project

Rename github.com/relax-space/go-api to xxx/xxx/your-project-name

Rename go-api to your-project-name

⁠Run
$ docker-compose -f .\example\docker-compose.yml up -d
$ go run .

Visit http://127.0.0.1:8080/ping⁠

Visit swagger http://127.0.0.1:8080/docs⁠

⁠View logs

  1. download kafka.apache⁠
  2. start consumer ./kafka-console-consumer.bat --bootstrap-server localhost:9092 --from-beginning --topic behaviorlog
  3. request a api,like: http://localhost:8080/v1/fruits⁠
  4. consumer will accept info
{"action_id":"d14b340b-7b68-11ea-b68b-847beb364db6","service":"go-api","timestamp":"2020-04-11T04:21:10.657333+08:00","remote_ip":"::1","host":"localhost:8080","uri":"/v1/fruits","method":"GET","path":"/v1/fruits","referer":"http://localhost:8080/docs","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","status":200,"latency":29999000,"bytes_sent":67,"hostname":"SS-CN-XIAOXINMI","controller":"controllers.FruitAPIController","action":"GetAll"}

⁠Extensions

⁠References

Tag summary

Content type

Image

Digest

Size

14.7 MB

Last updated

over 5 years ago

docker pull relaxed/go-api