Ejemplo n.º 1
0
Archivo: app.go Proyecto: influx6/todo
package app

import (
	"github.com/influx6/relay/engine"
	"github.com/jmoiron/sqlx"
)

func initApp(appo *engine.Engine) {
	appo.RedirectAll("", "/", "/todo")

	db, err := sqlx.Open(appo.Db.Type, appo.Db.Addr)

	if err != nil {
		panic(err)
	}

	dbs := NewSQLTodo(db)

	//close the db connection
	// appo.OnClose = func(e *engine.Engine) {
	// 	db.Close()
	// }

	appo.Bind(NewTodoController("todo", dbs, appo))

}

//TodoApp server engine
var App = engine.NewEngine(engine.NewConfig(), initApp)
Ejemplo n.º 2
0
package app

import "github.com/influx6/relay/engine"

//Applo server engine
var App = engine.NewEngine(engine.NewConfig(), func(appo *engine.Engine) {

	// appo.OnInit = func(e *engine.Engine) {
	// 	e.ServeFile("/", "index.html")
	// }

})