Code Monkey home page Code Monkey logo

beego_app's Introduction

简介

这个基于beego框架的app,旨在熟悉beego框架下mvc的使用,以及go语言几web知识的学习

如何运行

sudo apt install mysql-server
go get github.com/astaxie/beego
go get github.com/beego/bee
git clone https://github.com/asu126/beego_app.git
cd beego_app && bee run
mysql命令行下初始化数据库: doc/sql_init.sql
访问页面:
http://localhost:8080
http://localhost:8080/dashbord 需登录

js

  • npm init
  • webpack
npm install --save webpack
  • 打包编译
node_modules/.bin/webpack

Webpack的强大功能

  • 生成Source Maps(使调试更容易)
  • 使用webpack构建本地服务器
npm install --save-dev webpack-dev-server
  • Loaders

  • css

npm install --save style-loader css-loader

** webpack 的热加载是通过起一个服务来监控文件的变化,并且是以内存文件的形式生成到内存中,所以beego demo 需要通过内部proxy来实现修改即可见。**

vue

  • install
npm install --save vue

cache

beego.BConfig.WebConfig.Session.SessionOn = true

  • 在Controller中操作Session
import (
    "github.com/astaxie/beego"
)
func (c *AdminController) Logindo() {
   username := c.GetString("username")
   c.SetSession("Adminname", username)        //设置Session
   adminName := c.GetSession("Adminname")     //读取Session
   c.DelSession("Adminname")                  //删除Session
   c.TplNames = "admin/login.html"
   }
}
  • 在非Controller中操作Session
import (
   "github.com/astaxie/beego/context"
)
var FilterAdmin = func(ctx *context.Context) {
ctx.Input.CruSession.Get("Adminname")            //读取Session
ctx.Input.CruSession.Set("Adminname","value")    //设置Session
ctx.Input.CruSession.Delete("Adminname")         //删除Session
}

参考说明

beego beego 工程 webpack webpack-1 vue vue-demo

go 学习资源

gobyexample tour.go-z studygolang gitbooks Golang资料整理 build-web-application-with-golang go doc 中文地址

grpc grpc-zh

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.