Serves contents of an SQLite database (or any other, if needed) as JSON via HTTP.
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
db
marshal
.gitignore
README.md
config-example.json
serve.go
serve_test.go

README.md

databee

Configuring

To configure your own databases, put a file named config.json in the working directory. If this file does not exist, the server will try to find the config-example.json and start with the test database for demonstration and/or testing purposes.

Have a look at the config-example.json file for configuration options.

Database support

For now, only sqlite3 is tested and supported. The basic functionality should work with all other databases supported by Go's database/sql. But the functionality to show all tables has to be implemented for each type separately.

Compiling and running from source

You'll need Go 1.4. Just for compiling older Go versions would do as well, but I use testing.M for test fixture setup which comes with Go 1.4.

To setup your Go environment have a look at https://golang.org/doc/code.html and http://skife.org/golang/2013/03/24/go_dev_env.html.

databee needs Mattn's go-sqlite3: https://github.com/mattn/go-sqlite3

    go get github.com/mattn/go-sqlite3
    go run serve.go ./..

You will see something similar to this in the stdout:

$ go run serve.go ./...
2015/03/29 16:04:51 WARNING: Expected config file config.json not found, using config-example.json for demonstration and test purposes.
2015/03/29 16:04:51 Got configuration config.Configuration{Port:"7242", Databases:[]config.DatabaseConfig{config.DatabaseConfig{Alias:"db", DbDriver:"sqlite3", DbConnectionString:"db/testdata/f-spot-test.db"}}}
2015/03/29 16:04:51 Registering handler for sqlite3 database db/testdata/f-spot-test.db under /db
2015/03/29 16:04:51 Server up and running under port 7242. Go to /config to see the actual configuration of databases.

Runing tests

    go test ./...

Installing

    go install

You will find the binary databee under $GOPATH/bin.