Пример #1
0
func main() {
	err := initializeConfig()
	if err != nil {
		fmt.Printf("Unable to initialize config: %v\n", err)
		os.Exit(1)
	}

	log := logging.NewLog15()
	c := controller.NewController(log)

	initializeRepo(c)
	initializeTokenService(c)

	fmt.Printf("Initializing root route: %s \n", conf.Routing.Root)
	r := controller.NewRouter(c, conf.Routing.Root)

	fmt.Printf("Listening on port %s\n", conf.Routing.Port)
	http.ListenAndServe(fmt.Sprintf(":%s", conf.Routing.Port), r)
}
Пример #2
0
import (
	"database/sql"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"testing"

	"leaguelog/logging"

	_ "leaguelog/Godeps/_workspace/src/github.com/lib/pq"
)

var log logging.Logger = logging.NewLog15()

var repo *PgRepository

type config struct {
	Database database `json:"database"`
}

type database struct {
	URL  string `json:"url"`
	Seed string `json:"seed"`
	Test string `json:"test"`
}

var c config
Пример #3
0
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"os"
	"strings"
	"testing"
	"time"

	"leaguelog/auth"
	"leaguelog/auth/jwt"
	"leaguelog/database/postgres"
	"leaguelog/logging"
	"leaguelog/model"
)

var log = logging.NewLog15()

var server *httptest.Server
var controller *Controller

var c config

type config struct {
	Database database `json:"database"`
}

type database struct {
	URL  string `json:"url"`
	Seed string `json:"seed"`
	Test string `json:"test"`
}