Giter Site home page Giter Site logo

goedu's Introduction

Vue + Gin + Gorm 随便说

日期:2020/03/10

背景

在家无聊搭建一个 Vue + Gin + Gorm 的程序,主要也是熟悉一下看了两天的Golang语言,在做的过程中能复习Golang的语法以及一些相关的前端Vue知识。

  • 熟悉了gin框架,以及中间件的使用
  • 熟悉了gorm数据库ORM的一些数据库操作
  • 复习Vue的一些相关知识点
  • 使用jwt-go搭建jwt验证,并把验证放到Gin中间件中
  • 使用yaml把配置文件独立到config文件夹

如何搭建

  1. frontend属于前端部分,进入到这个文件夹下
npm install && npm run serve
  1. 配置好数据库
  2. config文件夹,配置config.yaml
debug: true # 数据库调试,开启后命令行会显示对应的数据库操作
key: alexskywin # jwt加密串
mysql: # MySQL相关配置
  user: root
  pass:
  host: 127.0.0.1
  port: 3306
  database: demo
  charset: utf8mb4
  1. 运行main.go文件
go run main.go

毕竟只是快速看看怎么回事,go run就可以了。

总结

这个相当于一个前后端分离的架子,但是在做这个架子的时候,还是遇到了很多困难,翻看各种文档和各种Golang语法查漏补缺的时候,还是温故知新了不少东西。

说实话,如果不是公司有特别要求,我还是喜欢Laravel这个自动挡多一些。gin + gorm目前还是半自动档的框架,没办法谁让Golang火吖,不说精通但是也得会。不过Golang上手确实很快。

2020年Golang也会作为我一个研究的方向,当然不会丢下我的PHP,毕竟是世界上最好的语言!哈哈哈

goedu's People

Contributors

neilyoz avatar

Watchers

James Cloos 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.