Golang Introduction and Environmental Installation Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance — up to 40 times faster. If you need smashing performance, get yourself some Gin. Gin is a micro-framework developed by Golang, similar to Martinier’s API, with the emphasis on small ..
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 ..
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, ..
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, ..
Use JWT for identity verification Original address:The Portal of Fans of Fried Fish In the previous sections, we have basically completed the writing of API’s However, there are still some very serious problems, for example, our current API can be called at will, which is obviously not perfect and has problems. Then we adoptjwt-go(GoDoc) to ..
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, ..
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, ..
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 ..
Thus, dep is used to obtain the private library. Introduction depIs a dependency management tool. It requires 1.9 or newerGolangVersion to compile depIt can be used safely in the production process, but it is still in the official test stage, that is, it is not yet in place.go toolChina. But I think sooner or later: ..
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 ..
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 ..
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 $ ..