parkme-api

module
v0.0.0-...-d1a64ea Latest Latest
Warning

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

Go to latest
Published: May 22, 2016 License: MIT

README

wercker status

What's this?

This is the skeleton of a Web API written in Golang. In order to use it, you have to clone it, rename it as you want (also rename all the imports from 'gost' to your app's name) and then start coding over this template.

This template contains basic endpoints for Users (+ login system) and Transactions (payments made between users). Both the endpoints are fully working ones, however the user is free to modify/delete them as they will.

Configuration steps for the API

  1. Install Go and set up your GOPATH. Starting with version Go1.4, you also need to set the GOROOT_BOOTSTRAP variable, to the same path as your GOROOT.

  2. Install MongoDb

  3. Create a database named serverName_db and then create an user for the database using the following command in mongodb shell:

db.createUser( { user: "serverNameAdmin", pwd: "serverNamePass", roles: [ { role: "readWrite", db: "serverName_db" } ] } )

  1. Install all the necessary dependencies using the following command in the cmd/console/terminal:

go get -v

  1. For testing purposes, create another database named serverName_db_test, but don't create a user for it like for the main database. In order for the tests to run, you need to set the following environment variables correctly:

MONGODB_URL = connection_string_for_mongodb (i.e. 'mongodb://localhost:27017')

GOST_TESTAPP_DB_NAME = serverName_test_app_db_name

GOST_TESTAPP_DB_CONN = $MONGODB_URL/$GOST_TESTAPP_DB_NAME

GOST_TESTAPP_NAME = serverName_test_app_name

GOST_TESTAPP_INSTANCE = /gost-test/ (access path, such as: **/some_domain/gost-test/**some_link_path)

GOST_TESTAPP_HTTP = serverName_testapp_http_server (i.e. :7500 for localhost:7500/; use 0.0.0.0:7500 for access from outside the local domain)

If you don't want to use the terminal for creating the databases, you can always use Robomongo, a very easy to use GUI for mongodb.

Easily renaming the template

To rename this template from gost to your new application name that will be built over this, use the bash script named app-rename to easily do all the renaming (folders, files and imports). Use the --help flag for usage details"

Directories

Path Synopsis
api
Package api contains the API functionality helpers
Package api contains the API functionality helpers
cookies
Package cookies uses the DatabaseCookieStore type as its default cookie store for managing user sessions
Package cookies uses the DatabaseCookieStore type as its default cookie store for managing user sessions
Package config is used for application configuration management
Package config is used for application configuration management
orm
service
Package service contains all the services necessary for interacting with all the collections(tables) in the database.
Package service contains all the services necessary for interacting with all the collections(tables) in the database.

Jump to

Keyboard shortcuts

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