Code Monkey home page Code Monkey logo

simpleblockchain's Introduction

简易区块链模型

环境搭建

测试

在需要测试的文件夹下运行: go test -v .

-v 无论是否成功都显示输出

##Swagger 生成 在接口函数上 填写注释, 然后在根目录运行 swag init 更新文档

参数说明

@Summary 接口概要说明
@Description 接口详细描述信息
@Tags 用户信息   //swagger API分类标签, 同一个tag为一组
@accept json  //浏览器可处理数据类型,浏览器默认发 Accept: */*
@Produce  json  //设置返回数据的类型和编码
@Param id path int true "ID"    //url参数:(name;参数类型[query(?id=),path(/123)];数据类型;required;参数描述)
@Param name query string false "name"
@Success 200 {object} Res {"code":200,"data":null,"msg":""}  //成功返回的数据结构, 最后是示例
@Failure 400 {object} Res {"code":200,"data":null,"msg":""}
@Router /test/{id} [get]    //路由信息,一定要写上

@Param

1.参数名
2.参数类型,可以有的值是 formData、query、path、body、header
        formData 表示是 post 请求的数据,
        query 表示带在 url 之后的参数,
        path 表示请求路径上得参数,例如上面例子里面的 key,
        body 表示是一个 raw 数据请求,
        header 表示带在 header 信息中得参数。

3.参数类型
4.是否必须
5.注释```


##mod 依赖包相关

下载包 : go get "包的github地址"

一般为了防止包的更新以及版本问题, 在编译之前把所有先关包都导入到当前目录中
go mod vendor

simpleblockchain's People

Contributors

xgpc 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.