beego-mgo

command module
v0.0.0-...-a78190c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2014 License: BSD-2-Clause-Views Imports: 7 Imported by: 0

README

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
bill@ardanstudios.com

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.

Documentation

Overview

Package main provides sample web application for beego and mgo.

Directories

Path Synopsis
Package controllers implements the controller layer for the buoy API.
Package controllers implements the controller layer for the buoy API.
baseController
Package baseController implements boilerplate code for all baseControllers.
Package baseController implements boilerplate code for all baseControllers.
go-i18n
goi18n
The goi18n command formats and merges translation files.
The goi18n command formats and merges translation files.
i18n
Package i18n supports string translations with variable substitution and CLDR pluralization.
Package i18n supports string translations with variable substitution and CLDR pluralization.
i18n/bundle
Package bundle manages translations for multiple locales.
Package bundle manages translations for multiple locales.
i18n/language
Package language defines languages that implement CLDR pluralization.
Package language defines languages that implement CLDR pluralization.
i18n/locale
Package locale parses locale strings.
Package locale parses locale strings.
i18n/plural
Package plural defines CLDR plural categories.
Package plural defines CLDR plural categories.
i18n/translation
Package translation defines the interface for a translation.
Package translation defines the interface for a translation.
Package localize : en-US.go provides the localized messages for English in the United States Package localize : messages.go package provides support for handling different languages and cultures
Package localize : en-US.go provides the localized messages for English in the United States Package localize : messages.go package provides support for handling different languages and cultures
models
buoyModels
Package buoyModels contains the models for the buoy service.
Package buoyModels contains the models for the buoy service.
Package routes initializes the routes for the web service.
Package routes initializes the routes for the web service.
Package services implements boilerplate code for all services.
Package services implements boilerplate code for all services.
buoyService
Package buoyService implements the service for the buoy functionality.
Package buoyService implements the service for the buoy functionality.
test
endpointTests
Package endpointTests implements boilerplate code for all testing.
Package endpointTests implements boilerplate code for all testing.
serviceTests
Package serviceTests implements boilerplate code for all testing
Package serviceTests implements boilerplate code for all testing
utilities
helper
Package helper : catch.go implements boilerplate code for the web service.
Package helper : catch.go implements boilerplate code for the web service.
mongo
Package mongo provides mongo connectivity support.
Package mongo provides mongo connectivity support.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL