gwduan / beego-demo Goto Github PK
View Code? Open in Web Editor NEWA web demo using Beego framework, with MongoDB, MySQL and Redis support.
A web demo using Beego framework, with MongoDB, MySQL and Redis support.
when I run 'bee run':
| ___
| |/ / ___ ___
| ___ \ / _ \ / _
| |/ /| /| /
_/ _| __| v1.8.0
2018/03/13 18:51:11 INFO ▶ 0001 Using 'beego-demo' as 'appname'
2018/03/13 18:51:11 INFO ▶ 0002 Initializing watcher...
2018/03/13 18:51:13 SUCCESS ▶ 0003 Built Successfully!
2018/03/13 18:51:13 INFO ▶ 0004 Restarting 'beego-demo'...
2018/03/13 18:51:13 SUCCESS ▶ 0005 './beego-demo' is running...
panic: Error 1045: Access denied for user 'root'@'localhost' (using password: YES)
goroutine 1 [running]:
panic(0x52b6c0, 0xc420188580)
/usr/local/go1.7.3/src/runtime/panic.go:500 +0x1a1
beego-demo/models/mymysql.init.1()
/Users/annie/code/golang/src/beego-demo/models/mymysql/mymysql.go:26 +0x106
beego-demo/models/mymysql.init()
/Users/annie/code/golang/src/beego-demo/models/mymysql/mymysql.go:31 +0x3d
beego-demo/models.init()
/Users/annie/code/golang/src/beego-demo/models/users_io.go:38 +0x3d
beego-demo/controllers.init()
/Users/annie/code/golang/src/beego-demo/controllers/users.go:271 +0x71
main.init()
/Users/annie/code/golang/src/beego-demo/main.go:46 +0x42
Then I change the password to my root password and re-run:
| ___
| |/ / ___ ___
| ___ \ / _ \ / _
| |/ /| /| /
_/ _| __| v1.8.0
2018/03/13 18:52:54 INFO ▶ 0001 Using 'beego-demo' as 'appname'
2018/03/13 18:52:54 INFO ▶ 0002 Initializing watcher...
2018/03/13 18:52:55 SUCCESS ▶ 0003 Built Successfully!
2018/03/13 18:52:55 INFO ▶ 0004 Restarting 'beego-demo'...
2018/03/13 18:52:55 SUCCESS ▶ 0005 './beego-demo' is running...
panic: Error 1044: Access denied for user 'root'@'localhost' to database 'beego_demo'
goroutine 1 [running]:
panic(0x52b6c0, 0xc420188580)
/usr/local/go1.7.3/src/runtime/panic.go:500 +0x1a1
beego-demo/models/mymysql.init.1()
/Users/annie/code/golang/src/beego-demo/models/mymysql/mymysql.go:26 +0x106
beego-demo/models/mymysql.init()
/Users/annie/code/golang/src/beego-demo/models/mymysql/mymysql.go:31 +0x3d
beego-demo/models.init()
/Users/annie/code/golang/src/beego-demo/models/users_io.go:38 +0x3d
beego-demo/controllers.init()
/Users/annie/code/golang/src/beego-demo/controllers/users.go:271 +0x71
main.init()
/Users/annie/code/golang/src/beego-demo/main.go:46 +0x42
Do I need to create database'beego_demo' myself? or it already exised? how can I get access to it?
2019/06/08 17:06:16.860 [D] [users.go:76] ParseLoginForm: &{ 123456}
2019/06/08 17:06:16.860 [D] [users.go:79] ValidLoginForm: Phone.Required:Can not be empty;Phone.Mobile:Must be valid mobile number;
2019/06/08 17:06:16.862 [D] [server.go:2774] | ::1| 200 | 4.9747ms| match| POST /v1/users/login r:/v1/users/login
2019/06/08 17:08:28.083 [D] [users.go:76] ParseLoginForm: &{ }
2019/06/08 17:08:28.084 [D] [users.go:79] ValidLoginForm: Phone.Required:Can not be empty;Phone.Mobile:Must be valid mobile number;Password.Required:Can not be empty;
2019/06/08 17:08:28.085 [D] [server.go:2774] | ::1| 200 | 3.0024ms| match| POST /v1/users/login r:/v1/users/login
2019/06/08 17:08:52.523 [D] [users.go:76] ParseLoginForm: &{ }
2019/06/08 17:08:52.524 [D] [users.go:79] ValidLoginForm: Phone.Required:Can not be empty;Phone.Mobile:Must be valid mobile number;Password.Required:Can not be empty;
2019/06/08 17:09:01.711 [D] [users.go:79] ValidLoginForm: Phone.Required:Can not be empty;Phone.Mobile:Must be valid mobile number;Password.Required:Can not be empty;
2019/06/08 17:09:01.712 [D] [server.go:2774] | ::1| 200 | 1.9957ms| match| POST /v1/users/login r:/v1/users/login
.\main.go:28: undefined: syscall.Setregid
.\main.go:31: undefined: syscall.Setreuid
2016/09/08 14:27:58 [ERRO] ============== Build failed ===================
在router源码类中有这么一段代码:
744 :if r.Method == http.MethodPost && context.Input.Query("_method") == http.MethodPost {
745 : method = http.MethodPut
746 : }
747 : if r.Method == http.MethodPost && context.Input.Query("_method") == http.MethodDelete {
748 : method = http.MethodDelete
749 :}
通过这两者的比较,744行中context.Input.Query("_method") == http.MethodPost 是不是应该改为context.Input.Query("_method") == http.MethodPut ?
看着大段拼sql好揪心
this errors:
controllers\roles.go:47: invalid operation: token.Claims["id"](type jwt.Claims does not support indexing)
controllers\roles.go:48: invalid operation: token.Claims["name"](type jwt.Claim s does not support indexing)
controllers\roles.go:49: invalid operation: token.Claims["exp"](type jwt.Claims does not support indexing)
controllers\roles.go:69: invalid operation: token.Claims["id"](type jwt.Claims does not support indexing)
controllers\roles.go:203: invalid operation: token.Claims["id"](type jwt.Claims does not support indexing)
controllers\roles.go:257: invalid operation: token.Claims["id"](type jwt.Claims does not support indexing)
I`m stuck on this error with Redis config....
Beego-demo runs on Win7 with Redis app "Docked" on a Synology NAS (reached at 192.168.1.xxx)
In conf/conf.app file, I've updated sessionproviderconfig and [cache] server sections with proper Redis ip/port.
But I still have this err msg :
panic: dial tcp 192.168.1.xxx:6379: connectex: No connection could be made because the target machine actively refused it.
Any idea ? Thx in advance.
Eric
请问你的jwt-go具体是怎么使用的?
我看代码是在/roles/auth这个路由里面生成了一个token然后封装成json传给客户端,但是客户端也没有任何操作,这个是怎么写到http header里的?GetOne GetAll都有解析token,但是我没看见怎么写入的,能讲解一下吗
2016/05/18 15:12:16 [router.go:829][D] | GET | / | 7.134515ms | match | / |
2016/05/18 15:12:16 [staticfile.go:51][W] Can't find/open the file: /favicon.ico file not find
我用postman访问/v1/roles/auth
报503 | 11.0006ms| nomatch
路径没有匹配
前面还有,NOAUTH Authentication required.
这个是程序的无权访问吗,但是这个路由路径是获取token的,这也有权限限制那怎么搞
你好,我根据beego提供的controller session机制,使用redis作为存储,我跟了下代码打印,的确进入了sess_redis.go这个里面的set方法,但是redis-server查询不到对应的key。但是在代码里里面通过getSession可以获取到,是不是beego在使用redis存储session的时候,用了其他的名字?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.