Git Product home page Git Product logo

samples's Introduction

Beego samples

中文文档

This is mainly for beego sample applications, you can either study how to use beego through this project, play around with it, open an issue to tell us what sample you expect, or even pull request with a sample.

Updated for beego v1.6

Installation

Install beego

In github, Fork https://github.com/beego/samples

# you should have set up your GOPATH by now
cd $GOPATH/src
# now clone your forked repo.
git clone https://github.com/yourname/samples

Samples

  • WebIM: Chat room demo based on long polling and WebSocket.
  • ShortURL: shouturl app based on beego. API applications
  • Todo: todo app based on beego.angularJS with API which is designed by beego.

samples's People

Contributors

astaxie avatar awengo avatar nobjohns avatar pauloasilva avatar scotthuangzl avatar unknwon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples's Issues

WebIM vulnerable to XSS

Hi there,
The WebIM sample is vulnerable to XSS, specifically the "Chat history" feature.

Whereas the uname parameter is properly handled by the template engine 1, the same is not true when handled and appended to the DOM by the JavaScript 2, 3, 4.

A crafted malicious Username like John <script>alert('Doe')</script> will display an alert box on every users' chat window as soon the new joins the room.

Chat messages suffer from the exact same problem: sending a message like Hello <script>alert('everyone')</script> will trigger an alert box on every users's chat window.

Please consider fixing this issue as many developers may build on top of your sample.

Regards,
Paulo A. Slva

/v1/shorten 接口连续传入相同的url会 crash

第二次传入同一个url, 的时候这行代码返回值是nil, 不知道是不是cache的bug。
result.UrlShort = urlcache.Get(urlmd5).(string)

2014/09/24 21:44:14 [C] the request url is /v1/shorten
2014/09/24 21:44:14 [C] Handler crashed with error interface conversion: interface is nil, not string
2014/09/24 21:44:14 [C] /usr/local/go/src/pkg/runtime/panic.c:248
2014/09/24 21:44:14 [C] /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease530016500/go/src/pkg/runtime/iface.goc:292
2014/09/24 21:44:14 [C] /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease530016500/go/src/pkg/runtime/iface.goc:280
2014/09/24 21:44:14 [C] /Users/1/kanbox/gocode/src/shorturl/controllers/short.go:36
2014/09/24 21:44:14 [C] /Users/1/kanbox/gocode/src/github.com/astaxie/beego/router.go:721
2014/09/24 21:44:14 [C] /usr/local/go/src/pkg/net/http/server.go:1673
2014/09/24 21:44:14 [C] /usr/local/go/src/pkg/net/http/server.go:1174
2014/09/24 21:44:14 [C] /usr/local/go/src/pkg/runtime/proc.c:1445

Logo Proposal

Good Day !
i love to work with your project, can i submit my logo design for it ?

运行起来报这个错 ,是我姿势不对么?貌似跟本地化有关哈~~

2017/11/02 15:59:59 [D] Loading language:
2017/11/02 15:59:59 [E] Fail to set message file: open conf/locale_.ini: no such file or directory
2017/11/02 15:59:59 [I] beego 0.1.1.0227
2017/11/02 15:59:59 [I] http server Running on http://:8080
2017/11/02 16:00:04 [C] the request url is /
2017/11/02 16:00:04 [C] Handler crashed with error can't find templatefile in the path:views/welcome.html
2017/11/02 16:00:04 [C] /usr/local/go/src/runtime/asm_amd64.s:509
2017/11/02 16:00:04 [C] /usr/local/go/src/runtime/panic.go:491
2017/11/02 16:00:04 [C] /data/code/go/src/github.com/astaxie/beego/template.go:73
2017/11/02 16:00:04 [C] /data/code/go/src/github.com/astaxie/beego/controller.go:263
2017/11/02 16:00:04 [C] /data/code/go/src/github.com/astaxie/beego/controller.go:214
2017/11/02 16:00:04 [C] /data/code/go/src/github.com/astaxie/beego/controller.go:194
2017/11/02 16:00:04 [C] /data/code/go/src/github.com/astaxie/beego/router.go:827
2017/11/02 16:00:04 [C] /usr/local/go/src/net/http/server.go:2619
2017/11/02 16:00:04 [C] /usr/local/go/src/net/http/server.go:1801
2017/11/02 16:00:04 [C] /usr/local/go/src/runtime/asm_amd64.s:2337

todo

todo 项目运行后 会有一个 2017/04/19 21:10:10 [staticfile.go:61] [W] Can't find the file: static/js/angular.min.js.map stat static/js/angular.min.js.map: no such file or directory

waring不影响运行但是,我想知道原因。谢谢

Sample with a database

Hello,

I am new to Beego and I'm really enjoying the framework, I was wondering if it was possible to include a sample that had a database back-end.

There are probably lots of ways to structure this but if a sample included one possible way (the idiomatic way) it would really be helpful for new people.

For example, it would answer some of the following questions (of which I'm unsure about myself).

  1. How do I connect my application to a database
  2. Where should my CRUD logic go (in the model or in the controller?)

一个空的文件夹

$ go get github.com/gorilla/websocket
$ go get github.com/beego/i18n
执行完这两条指令后目录仍是空的,什么都没有,请问这是怎么回事儿啊?

聊天室的链表循环处理有问题

for ch := waitingList.Back(); ch != nil; ch = ch.Prev() { ch.Value.(chan bool) <- true waitingList.Remove(ch) }
chatroom.go 文件中的第76行---79行的链表循环中删除节点的代码操作是有问题的,节点被删除后继续循环操作导致链表某些元素无法真正的被遍历处理,进而部分聊天室的成员会由于chanel阻塞而无法获取到消息,请处理下。

sample/Todo cannot compile

it looks the import path should changed to be as below:
samples/WebIM/controllers

Goland cannot find the packet from github.

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.