Git Product home page Git Product logo

go-zero-quick-start's Introduction

a Go-zero quick start

文档v1

后端api生成方法:

  1. 在go目录下创建xxx文件夹,并编写xxx.api (api写法:https://go-zero.dev/docs/tasks/dsl/api)
  2. goctl生成 goctl api go -api xxx.api -dir .(每次修改api文件后都要执行一次以修正自动生成的代码)
  3. 在logic中书写后端逻辑。(new一个respose)。
  4. 启动服务例:go run web/go/weather-Beta/weather.go
  5. 测试例
curl -X GET -H "Content-Type: application/json" -d '{
  "longitude": "xxx",
  "latitude": "xxx",
  "city": "KM"
}' http://localhost:8888/v1/weather/daily
  1. 编译:xxx文件夹下,env GOOS=linux GOARCH=amd64 go build

  2. 执行生成的运行文件

go-zero-quick-start's People

Contributors

nial4 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.