Giter VIP home page Giter VIP logo

go-gin's Introduction

golang gin框架学习

运行go的文件直接go run main.go

快速开始

go在go 1.13以上的时候有一个工作区的概念, 可以创建不同的模块, 有点类似mono的不同服务的概念

在代码中已经使用的情况下可以直接用go mod tidy来下载依赖

工作区

go work init
mkdir common && cd common
# 添加工作区
go work use ./common
# mod初始化
go mod init
# 添加mod
# 安装gin -u表示拉去网络最新版本的包
go get -u github.com/gin-gonic/gin

数据库

https://gorm.io/ gorm官网

启动mysql的docker容器

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

需要安装gorm 和 mysql的驱动

go get -u gorm.io/gorm
go get -u gorm.io/driver/mysql

记录需要学习知识点

RandomString 方法, 查看其中的make(byte[], n), rand.Intn() 安装jwt v4

go get -u github.com/dgrijalva/jwt-go/v4

go-gin's People

Contributors

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