README
¶
QOR Example Application
This is an example application to show and explain features of QOR.
Quick Start
Prerequisites
- If you have not already done so, install a GORM supported database — mySQL, Postgres or SQLite
- Install Go version 1.8 or later
- Configure the GOPATH environment
$> export GOPATH=~/go
Get example app
$> go get -u github.com/qor/qor-example
Setup the database — if using the default mysql database:
$> mysql -uroot -p
mysql> CREATE DATABASE qor_example;
Or, if using Postgres:
$> psql -d postgres
psql# create role <rolename> with login createdb;
psql# alter role <rolename> with password '<a strong password>'
psql Ctrl-d
$ psql --username=<rolename> -d postgres
psql# create database <db_name>
$> cd ${GOPATH}/src/github.com/<account owner folder>qor-example/config/
$> cp application.example.yml to application.yml
$> cp database.example.yml database.yml
$> cp smtp.example.yml smtp.yml
Edit database.yml to configure the application to connect to the database
$> vim database.yml
:i edit as below
db:
name: <db_name>
adapter: postgres
host: localhost
port: 5432
user: <rolename>
password: <a strong password>
:wq
$>
TODO: Integrate with Hashicorp Vault for management of user credentials
Run Application
$> cd $GOPATH/src/github.com/qor/qor-example
$> go run main.go # The server listens on port 7000
$> Ctrl-C # to interupt
Alternatively, to start the port on an alternate port
$> cd $GOPATH/src/github.com/qor/qor-example
$> (export PORT=<NNNN> && go run main.go) # Listens on port NNNN
$> Ctrl-C # to interupt
Generate some sample data
$> go get github.com/azumads/faker
$> cd $GOPATH/src/github.com/qor/qor-example
$> go run config/db/seeds/main.go config/db/seeds/seeds.go
TODO: Investigate the warnings about GORM and migrations and the warnings about the FullWidthBannerEditor
Run tests (Pending)
$> go test $(go list ./... | grep -v /vendor/ | grep -v /db/)
Admin Management Interface
Qor Example admin configuration
Online Demo Website: demo.getqor.com/admin
RESTful API
Online Example APIs:
- Users: http://demo.getqor.com/api/users.json
- User 1: http://demo.getqor.com/api/users/1.json
- User 1's Orders http://demo.getqor.com/api/users/1/orders.json
- User 1's Order 1 http://demo.getqor.com/api/users/1/orders/1.json
- User 1's Orders 1's Items http://demo.getqor.com/api/users/1/orders.json
- Orders: http://demo.getqor.com/api/orders.json
- Products: http://demo.getqor.com/api/products.json
License
Released under the MIT License.
Click to show internal directories.
Click to hide internal directories.