コード例 #1
0
ファイル: routes.go プロジェクト: malston/pezauth
//InitRoutes - initialize the mappings for controllers against valid routes
func InitRoutes(m *martini.ClassicMartini, redisConn Doer, mongoConn pezdispenser.MongoCollectionGetter, authClient AuthRequestCreator) {
	setOauthConfig()
	keyGen := NewKeyGen(redisConn, &GUIDMake{})
	m.Use(render.Renderer())
	m.Use(martini.Static(StaticPath))
	m.Use(oauth2.Google(OauthConfig))
	authKey := NewAuthKeyV1(keyGen)

	m.Get("/info", authKey.Get())
	m.Get(ValidKeyCheck, NewValidateV1(keyGen).Get())

	m.Get("/me", oauth2.LoginRequired, DomainCheck, NewMeController().Get())

	m.Get("/", oauth2.LoginRequired, DomainCheck, func(params martini.Params, log *log.Logger, r render.Render, tokens oauth2.Tokens) {
		userInfo := GetUserInfo(tokens)
		r.HTML(SuccessStatus, "index", userInfo)
	})

	m.Post("/sandbox", oauth2.LoginRequired, DomainCheck, NewSandBoxController().Post())

	m.Group(URLAuthBaseV1, func(r martini.Router) {
		r.Put(APIKey, authKey.Put())
		r.Get(APIKey, authKey.Get())
		r.Delete(APIKey, authKey.Delete())
	}, oauth2.LoginRequired, DomainCheck)

	m.Group(URLOrgBaseV1, func(r martini.Router) {
		pcfOrg := NewOrgController(mongoConn, authClient)
		r.Put(OrgUser, pcfOrg.Put())
		r.Get(OrgUser, pcfOrg.Get())
	}, oauth2.LoginRequired, DomainCheck)
}
コード例 #2
0
func SetupRoutes(m *martini.ClassicMartini) {
	m.Get("/", Leaderboard)
	m.Get("/leaders", GetLeaders)
	m.Get("/leaders/:page", GetLeaders)
	m.Get("/leader/:name", GetLeader)
	m.Post("/leader", binding.Json(Leader{}), binding.ErrorHandler, PostLeader)
}
コード例 #3
0
ファイル: http_server.go プロジェクト: joshk/hustle
func (srv *httpServer) setupRoutes(m *martini.ClassicMartini) {
	m.Get(`/`, func() string { return "every day" })
	m.Get(`/pusher/info`, srv.getPusherInfo)
	m.Post(`/apps/:app_id/events`, binding.Json(Event{}), srv.createAppEvents)
	m.Get(`/timeline/:id`, handleStatsJSONP)
	log.Printf("Set up HTTP Server routes on %#v\n", m)
}
コード例 #4
0
ファイル: router.go プロジェクト: lg0491986/pando-cloud
// martini router
func route(m *martini.ClassicMartini) {
	// find a device by key
	m.Get("/application/v1/device/info", GetDeviceInfoByKey)

	// find a device by identifier
	m.Get("/application/v1/devices/:identifier/info", ApplicationAuthOnDeviceIdentifer, GetDeviceInfoByIdentifier)

	// get devie current status
	m.Get("/application/v1/devices/:identifier/status/current",
		ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
		GetDeviceCurrentStatus)

	// get devie latest status
	m.Get("/application/v1/devices/:identifier/status/latest",
		ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
		GetDeviceLatestStatus)

	// set device status
	m.Put("/application/v1/devices/:identifier/status",
		ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
		SetDeviceStatus)

	// send a command to device
	m.Post("/application/v1/devices/:identifier/commands",
		ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
		SendCommandToDevice)

}
コード例 #5
0
ファイル: routers.go プロジェクト: lihex/vim-tips-web
func InitRouters(m *martini.ClassicMartini) {
	//Routers for front pages
	m.Get("/", HandleIndex)
	m.Get("/tips/:Id", HandleTip)
	m.Get("/random_tips/txt", HandleRandomTxtTip)
	m.Get("/random_tips/json", HandleRandomJsonTip)
	m.Get("/casts", paginate.Handler, HandleCasts)
	m.Get("/casts/:Id", ShowCast)
	m.Get("/api", HandleAPI)
	m.Get("/tools", HandleTools)
	m.Get("/about", HandleAbout)
	m.Get("/admin/login", ShowLoginPage)
	m.Get("/admin/logout", HandleLogout)
	m.Post("/admin/login", HandleLogin)

	//Routers for admin panel
	m.Group("/admin", func(r martini.Router) {
		r.Get("/index", HandleAdminIndex)
		r.Get("/tips", paginate.Handler, AdminShowTips)
		r.Post("/tips/add", AdminAddTips)
		r.Post("/tips/del", AdminDelTips)
		r.Post("/tips/update", AdminModifyTips)
		r.Get("/casts", paginate.Handler, AdminShowCasts)
		r.Get("/password", AdminPassword)
		r.Post("/password", AdminUpdatePassword)
		r.Get("/casts/add", AdminAddCastsPage)
		r.Post("/casts", AdminAddCasts)
		r.Post("/casts/del", AdminDelCasts)
		r.Post("/casts/modify", AdminUpdateCasts)
		r.Get("/casts/modify/:Id", AdminModifyCasts)
	}, validateSession)

}
コード例 #6
0
ファイル: utils.go プロジェクト: nquinlan/contribot
func mapRoutes(m *martini.ClassicMartini) {
	m.Post("/githook", handleGitHook)
	m.Get("/auth", authGitHub)
	m.Get("/githubAuth", gitHubAuthMiddleware, getUserFromToken)
	m.Get("/award", gandalf, awardUser)
	m.Post("/submission", gandalf, csrf.Validate, handleSubmission)
}
コード例 #7
0
ファイル: web.go プロジェクト: 0-T-0/orchestrator
// RegisterDebug adds handlers for /debug/vars (expvar) and /debug/pprof (net/http/pprof) support
func (this *HttpWeb) RegisterDebug(m *martini.ClassicMartini) {

	m.Get("/debug/vars", func(w http.ResponseWriter, r *http.Request) {
		// from expvar.go, since the expvarHandler isn't exported :(
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		fmt.Fprintf(w, "{\n")
		first := true
		expvar.Do(func(kv expvar.KeyValue) {
			if !first {
				fmt.Fprintf(w, ",\n")
			}
			first = false
			fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
		})
		fmt.Fprintf(w, "\n}\n")
	})

	// list all the /debug/ endpoints we want
	m.Get("/debug/pprof", pprof.Index)
	m.Get("/debug/pprof/cmdline", pprof.Cmdline)
	m.Get("/debug/pprof/profile", pprof.Profile)
	m.Get("/debug/pprof/symbol", pprof.Symbol)
	m.Post("/debug/pprof/symbol", pprof.Symbol)
	m.Get("/debug/pprof/block", pprof.Handler("block").ServeHTTP)
	m.Get("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
	m.Get("/debug/pprof/goroutine", pprof.Handler("goroutine").ServeHTTP)
	m.Get("/debug/pprof/threadcreate", pprof.Handler("threadcreate").ServeHTTP)
}
コード例 #8
0
ファイル: routeUserDelete.go プロジェクト: johnnywww/swd
func (routeUserDelete *RouteUserDelete) Routes(m *martini.ClassicMartini) {
	m.Post("/user/delete", func(w http.ResponseWriter, r *http.Request) string {
		log.WriteLog("addr: /user/delete")
		SetResponseJsonHeader(w)
		setupInfo := model.SetupInfo{}
		setupHandle := model.NewSetupHandle()
		if !setupHandle.GetSetupInfo(&setupInfo) {
			return model.GetErrorDtoJson("读取用户信息失败")
		}
		r.ParseForm()
		log.WriteLog("user delete %v", r.Form)
		userName := r.Form.Get("username")

		if common.USER_NAME_ADMIN == userName {
			log.WriteLog("删除admin失败")
			return model.GetErrorDtoJson("删除管理员信息失败")
		}
		if !setupInfo.DeleteUserByUserName(userName) {
			log.WriteLog("删除用户信息失败")
			return model.GetErrorDtoJson("删除用户信息失败")
		}

		if !setupHandle.SaveSetupInfo(&setupInfo) {
			log.WriteLog("保存删除用户信息失败")
			return model.GetErrorDtoJson("保存删除用户信息失败")
		}
		return model.GetDataDtoJson(nil)
	})
}
コード例 #9
0
ファイル: router.go プロジェクト: oskycar/pando-cloud
// martini router
func route(m *martini.ClassicMartini) {
	// regist a device
	m.Post("/v1/devices/registration", binding.Json(DeviceRegisterArgs{}), RegisterDevice)

	// auth device
	// m.Post("v1/devices/authentication", binding.Json(DeviceAuthArgs{}), actions.AuthDevice)

}
コード例 #10
0
ファイル: routers.go プロジェクト: leisunstar/hxs
func Router(m *martini.ClassicMartini) {
	m.Get("/", controller.Index)
	m.Get("/upload_records", controller.UploadRecords)
	m.Post("/upload_records", controller.UploadRecords)
	m.Get("/choose/exam", controller.ChooseExam)
	//答题
	m.Get("/answer", controller.Answer)
	m.Post("/answer", controller.Answer)
}
コード例 #11
0
ファイル: routes.go プロジェクト: jijeshmohan/martini-spike
func InitRoutes(m *martini.ClassicMartini) {
	m.Get("/", ListBlogs)
	m.Get("/new", NewBlog)
	m.Post("/new", binding.Form(models.Post{}), CreateBlog)
	m.Get("/post/:id", ShowBlog)

	m.NotFound(func(r render.Render) {
		fmt.Println("....................................................")
		r.HTML(404, "status/404", "")
	})
}
コード例 #12
0
ファイル: user.go プロジェクト: xrstf/raziel
func setupUsersCtrl(app *martini.ClassicMartini) {
	app.Group("/users", func(r martini.Router) {
		app.Get("", usersIndexAction)
		app.Get("/add", usersAddAction)
		app.Post("", sessions.RequireCsrfToken, usersCreateAction)
		app.Get("/:id", usersEditAction)
		app.Put("/:id", sessions.RequireCsrfToken, usersUpdateAction)
		app.Delete("/:id", sessions.RequireCsrfToken, usersDeleteAction)
		app.Get("/:id/delete", usersDeleteConfirmAction)
	}, sessions.RequireLogin)
}
コード例 #13
0
ファイル: keys-service.go プロジェクト: kurtinlane/submarine
func RegisterWebService(server *martini.ClassicMartini) {
	path := "/api/v1/keys"

	server.Get(path, Get)
	//server.Get(path+"/:email", Get)

	server.Post(path, Post)

	server.Delete(path, Delete)
	server.Delete(path+"/:id", Delete)
}
コード例 #14
0
ファイル: util.go プロジェクト: tartaruszen/dbstream
func RegisterRESTFunction(f RESTFunction, cm *martini.ClassicMartini) {
	path := f.GetPath()

	cm.Get(path, f.RGet)
	cm.Get(path+"/:id", f.RGet)

	cm.Post(path, f.RPost)
	cm.Post(path+"/:id", f.RPost)

	cm.Delete(path, f.RDelete)
	cm.Delete(path+"/:id", f.RDelete)
}
コード例 #15
0
func (routeServerConfigSave *routeServerConfigSave) Routes(m *martini.ClassicMartini) {
	m.Post("/server/saveconfig", func(w http.ResponseWriter, r *http.Request, re render.Render) string {
		log.WriteLog("addr: /server/saveconfig")
		shttp.SetResponseJsonHeader(w)
		r.ParseForm()
		err := service.NewServerConfigSaveRequestHandle().Save(r)
		if nil != err {
			return model.GetErrorObjDtoJson(err)
		}
		return model.GetDataDtoJson("")
	})
}
コード例 #16
0
ファイル: api.go プロジェクト: aramalipoor/farmer
func registerRoutes(server *martini.ClassicMartini) {
	// Box
	server.Post("/boxes", binding.Bind(request.CreateRequest{}), boxCreate)
	server.Put("/boxes/:name", binding.Bind(request.DeployRequest{}), boxDeploy)
	server.Get("/boxes", boxList)
	server.Get("/boxes/:name", boxInspect)
	server.Delete("/boxes/:name", boxDelete)

	// Domain
	server.Post("/boxes/:name/domain", binding.Bind(request.Domain{}), domainAdd)
	server.Delete("/boxes/:name/domain/:domain", domainDelete)
}
コード例 #17
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)
}
コード例 #18
0
ファイル: routeUserSave.go プロジェクト: johnnywww/swd
func (routeUserSave *RouteUserSave) Routes(m *martini.ClassicMartini) {
	m.Post("/user/save", func(w http.ResponseWriter, r *http.Request) string {
		log.WriteLog("addr: /user/save")
		SetResponseJsonHeader(w)
		setupInfo := model.SetupInfo{}
		setupHandle := model.NewSetupHandle()
		if !setupHandle.GetSetupInfo(&setupInfo) {
			return model.GetErrorDtoJson("读取用户信息失败")
		}
		r.ParseForm()
		log.WriteLog("user save %v", r.Form)
		ousername := r.Form.Get("ousername")
		username := r.Form.Get("username")
		addFlag := utils.IsEmptyStr(ousername)
		password := r.Form.Get("password")
		if utils.IsEmptyStr(username) {
			return model.GetErrorDtoJson("没有用户名称")
		}
		if utils.IsEmptyStr(password) {
			return model.GetErrorDtoJson("没有密码")
		}
		index := setupInfo.GetUserIndexByUserName(username)
		oindex := setupInfo.GetUserIndexByUserName(ousername)
		var pUserInfo *model.UserInfo = nil
		if addFlag {
			if index > -1 {
				return model.GetErrorDtoJson("用户名称输入重复")
			}
			userInfo := model.UserInfo{UserName: username, Password: password}
			setupInfo.AddUserInfo(userInfo)
			pUserInfo = &userInfo
		} else {
			if oindex < 0 {
				return model.GetErrorDtoJson("没有找到用户")
			} else {
				if index > -1 && oindex != index {
					return model.GetErrorDtoJson("用户名称输入重复")
				}
			}
			setupInfo.Users[oindex].UserName = username
			setupInfo.Users[oindex].Password = password
			pUserInfo = &setupInfo.Users[oindex]
		}
		if !setupHandle.SaveSetupInfo(&setupInfo) {
			log.WriteLog("保存删除用户信息失败")
			return model.GetErrorDtoJson("保存删除用信息失败")
		}
		return model.GetDataDtoJson(model.UserSaveInfo{UserInfo: *pUserInfo, OUserName: ousername, AddFlag: addFlag})
	})

}
コード例 #19
0
ファイル: auth.go プロジェクト: teamSUDOs/localise-it
func SetupAuth(martini *martini.ClassicMartini) {
	os.Mkdir(backendfile, 0755)
	backend_, err := httpauth.NewLeveldbAuthBackend(backendfile)
	if err != nil {
		log.Fatal(err.Error())
	}
	backend = backend_

	roles = make(map[string]httpauth.Role)
	roles["user"] = 30
	roles["admin"] = 80

	aaa, err = httpauth.NewAuthorizer(backend, []byte("cookie-encryption-key"), "user", roles)
	if err != nil {
		log.Fatal(err.Error())
	}

	users, err := backend.Users()
	if err != nil || len(users) == 0 {
		// create a default user
		hash, err := bcrypt.GenerateFromPassword([]byte("toor"), bcrypt.DefaultCost)
		//hash, err := bcrypt.GenerateFromPassword([]byte("l4ngu4g3"), bcrypt.DefaultCost)
		if err != nil {
			panic(err)
		}
		defaultUser := httpauth.UserData{Username: "******", Email: "", Hash: hash, Role: "admin"}
		//defaultUser := httpauth.UserData{Username: "******", Email: "", Hash: hash, Role: "admin"}
		err = backend.SaveUser(defaultUser)
		if err != nil {
			panic(err)
		}
	}

	martini.Post("/auth/login", doLogin)
	martini.Get("/auth/logout", doLogout)
	martini.Get("/auth/token", doGetToken)

	martini.Post("/auth/user", AssertRole("admin"), doAddUser)

	martini.Get("/auth/currentuser", doGetCurrentUser)
	martini.Get("/auth/user", AssertRole("admin"), doGetUsers)
	martini.Get("/auth/user/:username", AssertRole("admin"), doGetUser)

	martini.Put("/auth/user/:username", AssertRole("admin"), doUpdateUser)
	martini.Delete("/auth/user/:username", AssertRole("admin"), doDeleteUser)
	martini.Post("/auth/user/:username/allow", AssertRole("admin"), doAllow)
	martini.Post("/auth/user/:username/forbid", AssertRole("admin"), doForbid)

}
コード例 #20
0
ファイル: consumer.go プロジェクト: xrstf/raziel
func setupConsumersCtrl(app *martini.ClassicMartini) {
	app.Group("/consumers", func(r martini.Router) {
		app.Get("", consumersIndexAction)
		app.Get("/add", consumersAddAction)
		app.Post("", sessions.RequireCsrfToken, consumersCreateAction)
		app.Get("/:id", consumersEditAction)
		app.Put("/:id", sessions.RequireCsrfToken, consumersUpdateAction)
		app.Delete("/:id", sessions.RequireCsrfToken, consumersDeleteAction)
		app.Get("/:id/delete", consumersDeleteConfirmAction)
		app.Get("/:id/urls", consumersUrlsAction)
	}, sessions.RequireLogin)

	// public
	app.Get("/info/:consumer/:token", consumerInfoAction)
}
コード例 #21
0
ファイル: fake.go プロジェクト: marcin-ptaszynski/gohan
//FakeKeystone server for only test purpose
func FakeKeystone(martini *martini.ClassicMartini) {
	//mocking keystone v2.0 API
	martini.Post("/v2.0/tokens", func(w http.ResponseWriter, r *http.Request) {
		authRequest, err := ReadJSON(r)
		if err != nil {
			http.Error(w, "", http.StatusBadRequest)
		}
		username, err := util.GetByJSONPointer(authRequest, "/auth/passwordCredentials/username")
		if err != nil {
			http.Error(w, "", http.StatusBadRequest)
		}

		token, ok := fakeTokens[fmt.Sprintf("%v_token", username)]
		if !ok {
			http.Error(w, "", http.StatusUnauthorized)
		}

		serializedToken, _ := json.Marshal(token)
		w.Header().Set("Content-Type", "application/json")
		w.Header().Set("Content-Length", strconv.Itoa(len(serializedToken)))
		w.Write(serializedToken)
	})

	for tokenID, rawToken := range fakeTokens {
		serializedToken, _ := json.Marshal(rawToken)
		martini.Get("/v2.0/tokens/"+tokenID, func(w http.ResponseWriter, r *http.Request) {
			w.Write(serializedToken)
		})
	}
}
コード例 #22
0
ファイル: routeLogin.go プロジェクト: johnnywww/swd
func (routeLogin *RouteLogin) Routes(m *martini.ClassicMartini) {

	m.Get("/login", func(w http.ResponseWriter, r *http.Request, re render.Render) {
		gotoLoginPage(w, r, re)
	})

	m.Post("/login", func(w http.ResponseWriter, r *http.Request, re render.Render) {
		r.ParseForm()
		userInfo := checkLoginUser(r.Form, re, "login")
		if nil != userInfo {
			userInfo.SetLoginState()
			shttp.SetSessionUserInfo(w, r, userInfo)
			gotoRootPage(re, userInfo)
		}
	})
}
コード例 #23
0
ファイル: routes.go プロジェクト: SemQuery/web
func RegisterRoutes(m *martini.ClassicMartini) {
	m.Get("/", home.HomePage)

	m.Get("/search", query.SearchPage)
	m.Post("/index_source", query.InitiateIndex)

	m.Get("/socket", query.SocketPage)

	m.Get("/me", user.MePage)

	m.Get("/login", user.Login)
	m.Post("/logout", user.LogoutAction)

	m.Get("/githubcallback", user.GithubCallback)

	m.Get("/cextension", cextension.ExtensionPage)

	m.Get("/docs", docs.DocsPage)
}
コード例 #24
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)
	*/

	// To send the emails we just need a post request
	classicMartini.Post(path, webService.WebPost)
	classicMartini.Post(path+"/:id", webService.WebPost)

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

	*/
}
コード例 #25
0
ファイル: routeServerDelete.go プロジェクト: johnnywww/swd
func (routeServerDelete *RouteServerDelete) Routes(m *martini.ClassicMartini) {
	m.Post("/server/delete", func(w http.ResponseWriter, r *http.Request) string {
		log.WriteLog("addr: /server/delete")
		SetResponseJsonHeader(w)
		setupInfo := model.SetupInfo{}
		setupHandle := model.NewSetupHandle()
		if !setupHandle.GetSetupInfo(&setupInfo) {
			return model.GetErrorDtoJson("读取服务器信息失败")
		}
		r.ParseForm()
		log.WriteLog("server delete %v", r.Form)
		serverName := r.Form.Get("servername")
		if !setupInfo.DeleteServerByServerName(serverName) {
			log.WriteLog("删除服务器信息失败")
			return model.GetErrorDtoJson("删除服务器信息失败")
		}
		if !setupHandle.SaveSetupInfo(&setupInfo) {
			log.WriteLog("保存删除服务器信息失败")
			return model.GetErrorDtoJson("保存删除服务器信息失败")
		}
		return model.GetDataDtoJson(nil)
	})
}
コード例 #26
0
ファイル: service.go プロジェクト: dunkatron/metaupload
func registerProvider(m *martini.ClassicMartini, provider providers.Provider) {

	// Sideload an image from a remote URL
	type imageSideload struct {
		Url string `form:"url" binding:"required"`
	}

	m.Post("/providers/"+provider.Name()+"/sideload", binding.Bind(imageSideload{}), func(sideload imageSideload, r render.Render) {
		url, err := provider.SideLoadImage(sideload.Url)
		renderResult(url, err, r)
	})

	// Upload an image from post data
	type imageUpload struct {
		Image *multipart.FileHeader `form:"image" binding:"required"`
	}

	m.Post("/providers/"+provider.Name()+"/upload", binding.Bind(imageUpload{}), func(upload imageUpload, r render.Render) {
		// Open the file uploaded to us
		file, err := upload.Image.Open()
		if err != nil {
			renderResult(nil, genericError, r)
			return
		}
		defer file.Close()

		// Need to read image file bytes into a slice to pass into the provider
		contents, err := ioutil.ReadAll(file)
		if err != nil {
			renderResult(nil, genericError, r)
			return
		}

		url, err := provider.UploadImage(upload.Image.Filename, contents)
		renderResult(url, err, r)
	})
}
コード例 #27
0
ファイル: module.go プロジェクト: peteraba/go-blah
func addCoralRoutes(m *martini.ClassicMartini) {
	m.Get("/coral", ShowCorals)

	m.Get("/coral/:id", EditCoral)

	m.Post("/coral", CreateCoral)
	m.Post("/coral/new", CreateCoral)

	m.Put("/coral/:id", UpdateCoral)
	m.Post("/coral/:id", UpdateCoral)

	m.Delete("/coral/:id", DeleteCoral)
	m.Get("/coral/del/:id", DeleteCoral)
}
コード例 #28
0
ファイル: module.go プロジェクト: peteraba/go-blah
func addInvertebrateRoutes(m *martini.ClassicMartini) {
	m.Get("/invertebrate", ShowInvertebrates)

	m.Get("/invertebrate/:id", EditInvertebrate)

	m.Post("/invertebrate", CreateInvertebrate)
	m.Post("/invertebrate/new", CreateInvertebrate)

	m.Put("/invertebrate/:id", UpdateInvertebrate)
	m.Post("/invertebrate/:id", UpdateInvertebrate)

	m.Delete("/invertebrate/:id", DeleteInvertebrate)
	m.Get("/invertebrate/del/:id", DeleteInvertebrate)
}
コード例 #29
0
ファイル: module.go プロジェクト: peteraba/go-blah
func addComponentRoutes(m *martini.ClassicMartini) {
	m.Get("/component", ShowComponents)

	m.Get("/component/:id", EditComponent)

	m.Post("/component", CreateComponent)
	m.Post("/component/new", CreateComponent)

	m.Put("/component/:id", UpdateComponent)
	m.Post("/component/:id", UpdateComponent)

	m.Delete("/component/:id", DeleteComponent)
	m.Get("/component/del/:id", DeleteComponent)
}
コード例 #30
0
ファイル: module.go プロジェクト: peteraba/go-blah
func addLatestNewsRoutes(m *martini.ClassicMartini) {
	m.Get("/latest_news", ShowLatestNewsCollection)

	m.Get("/latest_news/:id", EditLatestNews)

	m.Post("/latest_news", CreateLatestNews)
	m.Post("/latest_news/new", CreateLatestNews)

	m.Put("/latest_news/:id", UpdateLatestNews)
	m.Post("/latest_news/:id", UpdateLatestNews)

	m.Delete("/latest_news/:id", DeleteLatestNews)
	m.Get("/latest_news/del/:id", DeleteLatestNews)
}