Tag : golang

Gin builds Blog API’s (1) Project address:https://github.com/EDDYCJY/go … Thinking First of all, before an initial project starts, everyone should think about it All kinds of program configurations are written in code, okay Is it appropriate that the API error code is hard-coded into the program Db handle to everyoneOpen, ok Get public parameters such as ..

Read more

API’s, Models for Tag Project address:https://github.com/EDDYCJY/go … This major section will cover the following knowledge points: gin: Golang’s micro-frame with excellent performance beego-validation: beego’s form validation library used in this section,Chinese document gorm, a developer-friendly ORM framework,English document com, toolkit Writing Business Logic We began to write business code, blog articles will haveLabelThe concept of, ..

Read more

API’s, Models for writing Article Project address:https://github.com/EDDYCJY/go … Define interface The logic of writing this section, let’s define the interface! Get list of articles: GET(“/articles “) Get the specified article: POST(“/articles/:id “) New article: POST(“/articles “) Update the specified article: PUT(“/articles/:id “) Delete the specified article: DELETE(“/articles/:id “) Write routing logic InroutersThe v1 version of, ..

Read more

Write a simple file log Original address:The Portal of Fans of Fried Fish In the previous section, we solved the problem that API’s can be accessed at will, so we have another problem now. Even our logs are output to the console, which is obviously unreasonable for a project, so this section is simply packagedlogLibrary, ..

Read more

Introduction and Environmental Installation Suppose we have a project requirement and hope to use itRpcAs internalAPICommunication, but also want to provide externalRestful Api, write two sets of too cumbersome does not conform to So we came up withGrpcas well asGrpc GatewayThis is what we need Preparation link At the official beginning of ourGrpc+Grpc GatewayBefore practice, ..

Read more

Hello World InPrevious sectionWe have finished the basic configuration of the environment 2 This section will begin to write a complex Hello World, which involves a lot of knowledge. It is suggested that everyone should seriously think about the concepts in it. Demand Due to the bias of this practiceGrpc+Grpc GatewayOn the other hand, our ..

Read more

Swagger, get to know InPrevious section, we completed a server support at the same timeRpcAndRESTful ApiAfter that, you thought you’d done it, only to find out suddenly that you wanted to write it.ApiDocking documents with front-end colleagues = =. . . Do you think there are any components that can be automatically generatedApiDocuments to solve ..

Read more

Preface If you are usingGolangThedepTools, I believe you may encounter this problem Dep version $ dep version dep: version : devel build date : git hash : go version : go1.10 go compiler : gc platform : linux/amd64 CurrentLatest releaseForv0.4.1 Problem UsedepPackage management tools, regardless of executiondep init -vOrdep ensure Always report version errors (no ..

Read more

Go dependency management tools Go dependency management tool Environmental requirements Golang >= 1.9 Dep Current version: dep: version : devel build date : git hash : go version : go1.10 go compiler : gc platform : linux/amd64 Latest releaseForv0.4.1 Installation go get -u github.com/golang/dep/cmd/dep If$GOPATH/binabsentPATH, you need to convert the generateddepFile from$GOPATH/binMove to$GOBIANunder Verification $ ..

Read more