• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language
    Go
  • License
    Other
  • Created almost 11 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sample Application For Using the BeeGo web framework with MGO

Beego Mgo Example

Copyright 2013 Ardan Studios. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in the LICENSE handle.

This application provides a sample to use the beego web framework and the Go MongoDB driver mgo. This program connects to a public MongoDB at MongoLab. A single collection is available for testing.

The project includes several shell scripts in the zscripts folder to make building, running and testing the web application easier.

GoingGo.net Post:
http://www.goinggo.net/2013/12/sample-web-application-using-beego-and.html

Ardan Studios
12973 SW 112 ST, Suite 153
Miami, FL 33186
[email protected]

Installation

-- YOU MUST HAVE BAZAAR INSTALLED
http://wiki.bazaar.canonical.com/Download

-- Get, build and install the code
go get github.com/goinggo/beego-mgo

-- Run the web service
cd $GOPATH/src/github.com/goinggo/beego-mgo/zscripts
./runbuild.sh

-- Run the tests
cd $GOPATH/src/github.com/goinggo/beego-mgo/zscripts
./runtests.sh

-- Test Web Service API's
Run the home page and go through the tabs
http://localhost:9003

Notes About Architecture

I have been asked why I have organized the code in this way?

The models folder contains the data structures for the individual services. Each service places their models in a separate folder.

The services folder contain the raw service calls that the business layer would use to implement higher level functionality.

The controller methods handle and process the requests.

The more that can be abstracted into the base controller and base service the better. This way, adding a new functionality is simple and you don't need to worry about forgetting to do something important. Authentication always comes to mind.

The utilities folder is just that, support for the web application, mostly used by the services. You have exception handling support, extended logging support and the mongo support.

The abstraction layer for executing MongoDB queries and commands help hide the boilerplate code away into the base service and mongo utility code.

Using environmental variables for the configuration parameters provides a best practice for minimizing security risks. The scripts in the zscripts folder contains the environment variables required to run the web application. In a real project these settings would never be saved in source control.

More Repositories

1

tracelog

Logging System Based On The Log/Logger Standard Library
Go
76
star
2

workpool

Pool go routines dedicated to processing work
Go
71
star
3

work

Implements a dynamic work pool of goroutines to perform tasks.
Go
64
star
4

concurrentwebservice

An example web service that uses concurrency and channels to provide search results from different providers.
Go
31
star
5

revel-mgo

Sample revel project with mgo support
CSS
31
star
6

MongoDB-Workshop

Beginner Workshop for MongoDB
24
star
7

service

Run your programs as a daemon or service
Go
19
star
8

mgoaction

Shows hwo to use MongoDB and Go to create actionable data,
Go
10
star
9

keyboard

How to bind a dynamic library using CGO
Go
9
star
10

timerdesignpattern

An example of using a channel to create a timer
Go
7
star
11

basicmgo

Shows how to make a basic mongodb call with mgo
Go
7
star
12

newssearch

Download RSS feeds and look for keywords and regular expressions
Go
6
star
13

jobpool

Normal and Priority queue of go routines for processing work
Go
5
star
14

GoMiami

Code For Go Miami Meetups
Go
4
star
15

timezone

Retrieve the timezone for any latitude, longitude position
Go
2
star
16

mongorules

How to use MongoDB to analyze data in a Go program
Go
2
star
17

workpooltest

Code that tests the performance of using a work pool.
Go
2
star
18

task

Framework code for building task oriented programs
Go
2
star
19

straps

A simple way to store application settings
Go
1
star
20

ironworker

Sample program to test Iron.IO IronWorker
Go
1
star
21

xslt

Example of processing an xslt stylesheet against an xml document.
XSLT
1
star
22

robot

Robot fun
Go
1
star