beerserver

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

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

Go to latest
Published: Jun 17, 2015 License: MIT Imports: 11 Imported by: 0

README

beerserver

An API server for home brewery.

Prerequisite

  • Go
  • Go workspace
  • Godep go get github.com/tools/godep
  • Node, NPM
  • Heroku Toolbelt (for deployment to Heroku)
  • MongoDB
  • flow (optional)

Usage

Install Go dependencies:

go get github.com/tools/godep
godep restore

Install Node dependencies and build assets:

npm install

Create .env:

MONGOLAB_URI=localhost:27017/beerserver

Run server:

go install && beerserver

and open http://localhost:3000

API

Channels
GET /channels
GET /channels/{id} {"name": "Beer Temperture"}
POST /channels
Datapoints
GET /channels/{channelId}/datapoints
POST /channels/{channelId}/datapoints {"at": "2012-04-23T18:25:43.511Z", value: 123.456}

Front-end development

Asset files in assets directory are copied/compiled into static directory. Edit only files in assets.

Copy static files and compile js once:

npm run build

Copy static files once, watch js files and compile them as needed:

npm run watch

or

npm start

Statically check common errors:

npm run eslint

Statically check types:

flow

Test

go test

Dependencies

Dependencies are managed with Godep. Whenever you add new dependency, make sure to:

godep save

and check the content of Godep directory into Git.

Deployment to Heroku

Use heroku-buildpack-multi:

heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi.git

Install also devDependencies of package.json:

heroku config:set NPM_CONFIG_PRODUCTION=false

Deploy and open browser:

git push heroku master
heroku open

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/joho/godotenv
Package godotenv is a go port of the ruby dotenv library (https://github.com/bkeepers/dotenv) Examples/readme can be found on the github page at https://github.com/joho/godotenv The TL;DR is that you make a .env file that looks something like SOME_ENV_VAR=somevalue and then in your go code you can call godotenv.Load() and all the env vars declared in .env will be avaiable through os.Getenv("SOME_ENV_VAR")
Package godotenv is a go port of the ruby dotenv library (https://github.com/bkeepers/dotenv) Examples/readme can be found on the github page at https://github.com/joho/godotenv The TL;DR is that you make a .env file that looks something like SOME_ENV_VAR=somevalue and then in your go code you can call godotenv.Load() and all the env vars declared in .env will be avaiable through os.Getenv("SOME_ENV_VAR")
_workspace/src/github.com/sendgrid/sendgrid-go
Package sendgrid provides a simple interface to interact with the SendGrid API
Package sendgrid provides a simple interface to interact with the SendGrid API
_workspace/src/gopkg.in/mgo.v2
Package mgo offers a rich MongoDB driver for Go.
Package mgo offers a rich MongoDB driver for Go.
_workspace/src/gopkg.in/mgo.v2/bson
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
_workspace/src/gopkg.in/mgo.v2/internal/scram
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
_workspace/src/gopkg.in/mgo.v2/txn
The txn package implements support for multi-document transactions.
The txn package implements support for multi-document transactions.

Jump to

Keyboard shortcuts

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