Beispiel #1
0
func main() {
	db := persistence.NewDatabase("dst")
	defer db.Close()

	repo := persistence.NewEmployeeRepo(db)
	e := repo.FindByFirstName("Peter")
	fmt.Println(e)

	quin := &entity.Employee{FirstName: "Peter", LastName: "Quin"}
	repo.Save(*quin)
}
Beispiel #2
0
func main() {
	db := persistence.NewDatabase("dst")
	defer db.Close()
	mux := httprouter.New()

	repo := persistence.NewEmployeeRepo(db)
	employee := handler.Employee{repo}
	mux.GET("/employees", employee.Index)
	mux.GET("/employees/:id", employee.Show)
	mux.POST("/employees", employee.Create)

	n := negroni.Classic()
	n.UseHandler(mux)
	n.Run(":3000")
}