コード例 #1
0
ファイル: reminders.go プロジェクト: ajem70/addaptsoft
func RouteReminders(m *martini.ClassicMartini, model models.Api) {
	m.Get("/api/reminders", model.Authenticated, model.GetAllReminders)
	m.Get("/reminders/:id", model.GetReminder)
	m.Post("/reminders", model.PostReminder)
	m.Put("/reminders/:id", model.PutReminder)
	m.Delete("/reminders/:id", model.DeleteReminder)
}
コード例 #2
0
// RegisterWebService adds martini routes to the relevant webservice methods
// based on the path returned by GetPath. Each method is registered once for
// the collection and once for each id in the collection.
func RegisterWebService(webService WebService,
	classicMartini *martini.ClassicMartini) {
	path := webService.GetPath()

	classicMartini.Get(path, webService.WebGet)
	classicMartini.Get(path+"/:id", webService.WebGet)

	classicMartini.Post(path, webService.WebPost)
	classicMartini.Post(path+"/:id", webService.WebPost)

	classicMartini.Delete(path, webService.WebDelete)
	classicMartini.Delete(path+"/:id", webService.WebDelete)
}