5 Star 26 Fork 193

韦选科 / go iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
LGPL-3.0

<<<<<<< HEAD go iris web

go iris web实战(响应式web)

目前的界面效果

登录 用户管理 角色管理 菜单管理

背景介绍

Golang + Iris(web框架) + Casbin(权限) + JWT + Vue(渐进式js)的web server框架,可前后端分离。
Iris的教程较少、零散、基础,且框架集合的完整实战案例极少(毕竟多数是用于工作,商业项目),几乎没有。后期可以直接使用。
源于开源,馈与社区。
称着还有精力在这方面。 QQ交流群:955576223

软件架构

目前支持单web架构,如果部署成前后端分离,可用nginx中间件代理(已添加跨域访问设置)。

  • 采用了Casbin做Restful的rbac权限控制;
  • 采用jwt做用户认证、回话控制;
  • 采用Mysql+xorm做持久层;
  • Vue前端项目持续更新中...,目前在front-vue分支;

项目目录结构

go-iris
  +-- a 该目录放的是临时的测试方法
  +-- conf 所有的配置文件目录
  +-- doc 说明文档(含go-bindata和mysql文件)
  +-- exec_packahe 可执行的打包文件(目前只有win 64bit的打包)
  +-- inits 所有需初始化的目录
  |       +-- parse 所有配置文件的初始化目录
  |       +-- init.go 用于初始化系统root用户,并注入所有service
  +-- middleware 包含的中间件目录
  |       +-- casbins 用于rbac权限的中间件的目录
  |       +-- jwts jwt中间件目录
  +-- resources 打包的前端静态资源文件
  +-- utils 工具包目录
  +-- web
  |       +-- db 数据库dao层目录
  |       +-- models 模型文件目录
  |       +-- routes 所有分发出来的路由的目录
  |       +-- supports 提供辅助方法的目录
  +-- main.go 入口

使用教程

  1. 每次修改/conf/app.yml/conf/db.yml的配置后,都需要在项目下执行命令打包配置数据:go-bindata -pkg parse -o inits/parse/conf-data.go conf/会生成/inits/parse/conf-data.go数据文件(执行成功后不会有任何提示,则反之);
  2. 部署时如有上述配置文件修改也需要再执行一遍上述命令,如此才能使配置修改生效
  3. go-bindata的安装和使用教程在项目下的/doc/go-bindata-usage文件中说明;
  4. 如果不使用前端,可以使用server端根目录下已经打包好的/resources/*前端文件;
  5. 如果要使用前端:
    • clone或下载front-vue分支代码
    • 推荐安装vue >= 2.xnode.js >= v8.9.3(LTS)环境。IDE推荐安装webstone
    • npm install安装本地前端环境
    • npm run dev启动本地前端环境
    • npm run build打包前端文件
    • 可以将打包的dist目录下的文件拷贝到server端目录的/resources/目录下

部署(不使用nginx情况下),这里在windows 64bit环境下操作为例。依如下步骤操作:

  1. 编译server端项目。在项目下使用命令行执行下面的命令(根据你的需要选择目标OS):
[[编译成当前环境]]
go install
[[编译成Linux 64bit]]
set CGO_ENABLED=0
set GOARCH=amd64
set GOOS=linux
go install
[[编译成Mac]]
set CGO_ENABLED=0
set GOARCH=amd64
set GOOS=darwin
go install
编译后的可执行文件在你本地go环境的GOPATH/bin/下找到。
  1. 启动项目。将server端打包后的可执行文件 和 /resources/*前端目录文件 放在同一级目录中,执行go打包后的可执行文件,启动。如下图: 部署时包的结构
  • 启动的本地服务地址:localhost:8088
  • 超级用户登录:

    初始账号:root
    初始密码: 123456

  • 一般用户登录:

    账号:yhm1
    密码:123456


安装环境

  • golang >= 1.9
  • nginx 不必须

    如果不使用前端环境,直接使用项目下的/resource/*的文件,则可以不需要下面的环境:

    • vue >= 2.x
    • node.js >= v8.9.3(LTS)

待需优化项,如:

  • 前端静态文件数据打包
  • 相同密码没随机加密
  • 同一用户生成的token,生成两次前一次没失效
  • 数据库连接池等等....

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码 ======= go iris web

go iris RESTful实战(响应式web)

目前的界面效果

登录 用户管理 角色管理 菜单管理

背景介绍

Golang + Iris(web框架) + Casbin(权限) + JWT + Vue(渐进式js)的web server框架,可前后端分离。
Iris的教程较少、零散、基础,且框架集合的完整实战案例极少(毕竟多数是用于工作,商业项目),几乎没有。后期可以直接使用。
源于开源,馈与社区。
称着还有精力在这方面。 QQ交流群:955576223

软件架构

目前支持单web架构,如果部署成前后端分离,可用nginx中间件代理(已添加跨域访问设置)。

  • 采用了Casbin做Restful的rbac权限控制;
  • 采用jwt做用户认证、回话控制;
  • 采用Mysql+xorm做持久层;
  • Vue前端项目持续更新中...,目前在front-vue分支;

项目目录结构

go-iris
  +-- a 该目录放的是临时的测试方法
  +-- conf 所有的配置文件目录
  +-- doc 说明文档(含go-bindata和mysql文件)
  +-- exec_packahe 可执行的打包文件(目前只有win 64bit的打包)
  +-- inits 所有需初始化的目录
  |       +-- parse 所有配置文件的初始化目录
  |       +-- init.go 用于初始化系统root用户,并注入所有service
  +-- middleware 包含的中间件目录
  |       +-- casbins 用于rbac权限的中间件的目录
  |       +-- jwts jwt中间件目录
  +-- resources 打包的前端静态资源文件
  +-- utils 工具包目录
  +-- web
  |       +-- db 数据库dao层目录
  |       +-- models 模型文件目录
  |       +-- routes 所有分发出来的路由的目录
  |       +-- supports 提供辅助方法的目录
  +-- main.go 入口

使用教程

  1. 每次修改/conf/app.yml/conf/db.yml的配置后,都需要在项目下执行命令打包配置数据:go-bindata -pkg parse -o inits/parse/conf-data.go conf/会生成/inits/parse/conf-data.go数据文件(执行成功后不会有任何提示,则反之);
  2. 部署时如有上述配置文件修改也需要再执行一遍上述命令,如此才能使配置修改生效
  3. go-bindata的安装和使用教程在项目下的/doc/go-bindata-usage文件中说明;
  4. 如果不使用前端,可以使用server端根目录下已经打包好的/resources/*前端文件;
  5. 如果要使用前端:
    • clone或下载front-vue分支代码
    • 推荐安装vue >= 2.xnode.js >= v8.9.3(LTS)环境。IDE推荐安装webstone
    • npm install安装本地前端环境
    • npm run dev启动本地前端环境
    • npm run build打包前端文件
    • 可以将打包的dist目录下的文件拷贝到server端目录的/resources/目录下

部署(不使用nginx情况下),这里在windows 64bit环境下操作为例。依如下步骤操作:

  1. 编译server端项目。在项目下使用命令行执行下面的命令(根据你的需要选择目标OS):
[[编译成当前环境]]
go install
[[编译成Linux 64bit]]
set CGO_ENABLED=0
set GOARCH=amd64
set GOOS=linux
go install
[[编译成Mac]]
set CGO_ENABLED=0
set GOARCH=amd64
set GOOS=darwin
go install
编译后的可执行文件在你本地go环境的GOPATH/bin/下找到。
  1. 启动项目。将server端打包后的可执行文件 和 /resources/*前端目录文件 放在同一级目录中,执行go打包后的可执行文件,启动。如下图: 部署时包的结构
  • 启动的本地服务地址:localhost:8088
  • 超级用户登录:

    初始账号:root
    初始密码: 123456

  • 一般用户登录:

    账号:yhm1
    密码:123456


安装环境

  • golang >= 1.9
  • nginx 不必须

    如果不使用前端环境,直接使用项目下的/resource/*的文件,则可以不需要下面的环境:

    • vue >= 2.x
    • node.js >= v8.9.3(LTS)

待需优化项,如:

  • 前端静态文件数据打包
  • 相同密码没随机加密
  • 同一用户生成的token,生成两次前一次没失效
  • 数据库连接池等等....

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码

f062733178f584d4966337090f7924c30633c783

  1. 新建 Pull Request
GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. [http://fsf.org/] Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

简介

go iris casbin jwt vue实战。go+iris(web框架)+casbin(权限)+jwt+vue的web server框架,响应式web,可前后端分离 展开 收起
Go
LGPL-3.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/wx85278161/go-iris.git
git@gitee.com:wx85278161/go-iris.git
wx85278161
go-iris
go iris
master

搜索帮助