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) }
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") }