Coder Social home page Coder Social logo

revel_mgo's Introduction

revel_mgo

About

revel_mgo is a code generator for Revel web framework https://revel.github.io/ with Mongodb database. It is mainly focus for RESTFul API. revel_mgo can setup mongodb in your revel project easily and it is using "gopkg.in/mgo.v2" for mongo databse driver. It can also generate models and controllers for your RESTFul API with revel framework.

Installation

go get github.com/kyawmyintthein/revel_mgo
cd $GOPATH/src/path/to/revel_mgo
go install revel_mgo

Usage

Setup mongo driver

revel_mgo mgo:setup

Update some code to startup mongo in your revel application

Add following code in your app.conf file and change your database configuration.

  mongo.database = database_name
  mongo.path = localhost
  mongo.maxPool = 20

Add following code in your init.go

func initApp() {
	Config, err := revel.LoadConfig("app.conf")
	if err != nil || Config == nil {
		log.Fatalf("%+v",err)
	}
	mongodb.MaxPool = revel.Config.IntDefault("mongo.maxPool", 0)
	mongodb.PATH,_ = revel.Config.String("mongo.path")
	mongodb.DBNAME, _ = revel.Config.String("mongo.database")
	mongodb.CheckAndInitServiceConnection()

}

Add this code under your init function of init.go file

revel.OnAppStart(initApp)

revel_mgo's People

Contributors

kyaw9 avatar kyawmyintthein avatar elidemayo avatar pollitux avatar xsami avatar

Watchers

James Cloos avatar Dwi Fahni Denni (dfdenni) avatar  avatar

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.