当前位置: 首页>>代码示例>>Golang>>正文


Golang goji.Delete函数代码示例

本文整理汇总了Golang中github.com/zenazn/goji.Delete函数的典型用法代码示例。如果您正苦于以下问题:Golang Delete函数的具体用法?Golang Delete怎么用?Golang Delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: startApi

func startApi(n ApiConfigurationNetwork) {
	apiListener, err := net.Listen("tcp", fmt.Sprintf("%v:%v", n.BindIP, n.BindPort))

	if err != nil {
		panic(err)
	}

	// Adding items:
	goji.Post("/food/add", routeAddFood)

	// Getting items
	goji.Get("/food/get/all", routeGetFoodAll)
	goji.Get("/food/get/id/:id", routeGetFoodById)
	goji.Get("/food/get/date/:year/:month/:day", routeGetFoodByDate)
	// goji.Get("/food/get/name/:name", routeGetFoodByName)

	// Removing items
	goji.Delete("/food/delete/id/:id", routeDeleteFoodById)
	goji.Delete("/food/delete/name/:name", routeDeleteFoodByName)

	// Updating items
	// goji.Put("/food/edit/id/:id", routeUpdateItemById)
	// goji.Put("/food/edit/name/:name", routeUpdateItemByName)

	goji.Get("/food/email/today", routeEmailSendToday)

	goji.ServeListener(apiListener)
}
开发者ID:mrcrilly,项目名称:micro-food-diary,代码行数:28,代码来源:microfood-api.go

示例2: setupWebRoutes

func setupWebRoutes(config *MailServer) {
	goji.Get("/status", func(c web.C, w http.ResponseWriter, r *http.Request) { status(config, c, w, r) })
	goji.Get("/mail", func(c web.C, w http.ResponseWriter, r *http.Request) { allMails(config, c, w, r) })
	goji.Get("/inbox/:email", func(c web.C, w http.ResponseWriter, r *http.Request) { inbox(config, c, w, r) })
	goji.Get("/email/:id", func(c web.C, w http.ResponseWriter, r *http.Request) { mailByID(config, c, w, r) })
	goji.Delete("/inbox/:email", func(c web.C, w http.ResponseWriter, r *http.Request) { deleteMails(config, c, w, r) })
	goji.Delete("/email/:id", func(c web.C, w http.ResponseWriter, r *http.Request) { deleteByID(config, c, w, r) })

}
开发者ID:digibib,项目名称:gosmtpd,代码行数:9,代码来源:web.go

示例3: SetupRoutes

func SetupRoutes() {
	for _, route := range routes {
		for _, method := range route.methods {
			switch method {
			case "GET":
				goji.Get(route.url, route.handler)
				break
			case "POST":
				goji.Post(route.url, route.handler)
				break
			case "PUT":
				goji.Put(route.url, route.handler)
				break
			case "PATCH":
				goji.Patch(route.url, route.handler)
				break
			case "DELETE":
				goji.Delete(route.url, route.handler)
				break
			default:
				goji.Handle(route.url, route.handler)
			}
		}
	}
}
开发者ID:shonenada-archives,项目名称:heron,代码行数:25,代码来源:urls.go

示例4: main

func main() {
	//Profiling
	// go func() {
	// 	log.Println(http.ListenAndServe(":6060", nil))
	// }()

	var (
		config *app.Config
	)

	envParser := env_parser.NewEnvParser()
	envParser.Name(appName)
	envParser.Separator("_")
	envSrc := app.Envs{}
	envParseError := envParser.Map(&envSrc)
	app.Chk(envParseError)

	app.PrintWelcome()

	switch envSrc.Mode {
	case app.MODE_DEV:
		logr.Level = logrus.InfoLevel
	case app.MODE_PROD:
		logr.Level = logrus.WarnLevel
	case app.MODE_DEBUG:
		logr.Level = logrus.DebugLevel
	}

	config = app.NewConfig(envSrc.AssetsUrl, envSrc.UploadPath)

	logFile, fileError := os.OpenFile(envSrc.LogPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0660)
	defer logFile.Close()
	if fileError == nil {
		logr.Out = logFile
	} else {
		fmt.Println("invalid log file; \n, Error : ", fileError, "\nopting standard output..")
	}

	redisService, reErr := services.NewRedis(envSrc.RedisUrl)
	reErr = reErr

	sqlConnectionStringFormat := "%s:%[email protected](%s:%s)/%s"
	sqlConnectionString := fmt.Sprintf(sqlConnectionStringFormat, envSrc.MysqlUser, envSrc.MysqlPassword,
		envSrc.MysqlHost, envSrc.MysqlPort, envSrc.MysqlDbName)
	mySqlService := services.NewMySQL(sqlConnectionString, 10)

	//TODO check
	baseHandler := handlers.NewBaseHandler(logr, config)
	userHandler := handlers.NewUserHandler(baseHandler, redisService, mySqlService)
	reqHandler := handlers.NewRequestHandler(baseHandler, redisService, mySqlService)

	goji.Post("/register", baseHandler.Route(userHandler.DoRegistration))
	goji.Post("/login", baseHandler.Route(userHandler.DoLogin))
	goji.Get("/bloodReq", baseHandler.Route(reqHandler.RemoveBloodRequest))
	goji.Post("/bloodReq", baseHandler.Route(reqHandler.MakeBloodRequest))
	goji.Delete("/bloodReq", baseHandler.Route(reqHandler.RemoveBloodRequest))
	goji.NotFound(baseHandler.NotFound)

	goji.Serve()
}
开发者ID:PayPal-OpportunityHack-BLR-2015,项目名称:bloodcare-hifx,代码行数:60,代码来源:server.go

示例5: Start

func (s *GossamerServer) Start() {
	goji.Get("/", s.HandleWebUiIndex)
	goji.Get("/things.html", s.HandleWebUiThings)
	goji.Get("/sensors.html", s.HandleWebUiSensors)
	goji.Get("/observations.html", s.HandleWebUiObservations)
	goji.Get("/observedproperties.html", s.HandleWebUiObservedProperties)
	goji.Get("/locations.html", s.HandleWebUiLocations)
	goji.Get("/datastreams.html", s.HandleWebUiDatastreams)
	goji.Get("/featuresofinterest.html", s.HandleWebUiFeaturesOfInterest)
	goji.Get("/historiclocations.html", s.HandleWebUiHistoricLocations)
	goji.Get("/css/*", s.HandleWebUiResources)
	goji.Get("/img/*", s.HandleWebUiResources)
	goji.Get("/js/*", s.HandleWebUiResources)

	goji.Get("/v1.0", s.handleRootResource)
	goji.Get("/v1.0/", s.handleRootResource)

	goji.Get("/v1.0/*", s.HandleGet)
	goji.Post("/v1.0/*", s.HandlePost)
	goji.Put("/v1.0/*", s.HandlePut)
	goji.Delete("/v1.0/*", s.HandleDelete)
	goji.Patch("/v1.0/*", s.HandlePatch)

	flag.Set("bind", ":"+strconv.Itoa(s.port))

	log.Println("Start Server on port ", s.port)
	goji.Serve()
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:28,代码来源:server.go

示例6: main

func main() {
	Logger.Formatter = new(logrus.JSONFormatter)

	// init
	db := InitDatabase("./myapp.db")
	defer db.Close()

	// middleware
	goji.Use(func(c *web.C, h http.Handler) http.Handler {
		fn := func(w http.ResponseWriter, r *http.Request) {
			c.Env["DB"] = db
			h.ServeHTTP(w, r)
		}
		return http.HandlerFunc(fn)

	})
	goji.Use(glogrus.NewGlogrus(Logger, "myapp"))
	goji.Use(middleware.Recoverer)
	goji.Use(middleware.NoCache)
	goji.Use(SetProperties)

	// handlers
	goji.Get("/users/", ListUsers)
	goji.Get(regexp.MustCompile(`/users/(?P<name>\w+)$`), GetUser)
	goji.Get("/*", AllMatchHandler)
	goji.Post(regexp.MustCompile(`/users/(?P<name>\w+)$`), RegisterUser)
	goji.Put("/users/:name", UpdateUserInfo)
	goji.Delete("/users/:name", DeleteUserInfo)

	goji.Serve()
}
开发者ID:t2y,项目名称:misc,代码行数:31,代码来源:main.go

示例7: main

func main() {
	var cfg Config
	stderrBackend := logging.NewLogBackend(os.Stderr, "", 0)
	stderrFormatter := logging.NewBackendFormatter(stderrBackend, stdout_log_format)
	logging.SetBackend(stderrFormatter)
	logging.SetFormatter(stdout_log_format)

	if cfg.ListenAddr == "" {
		cfg.ListenAddr = "127.0.0.1:63636"
	}
	flag.Set("bind", cfg.ListenAddr)
	log.Info("Starting app")
	log.Debug("version: %s", version)

	webApp := webapi.New()
	goji.Get("/dns", webApp.Dns)
	goji.Post("/dns", webApp.Dns)
	goji.Get("/isItWorking", webApp.Healthcheck)

	goji.Post("/redir/batch", webApp.BatchAddRedir)
	goji.Post("/redir/:from/:to", webApp.AddRedir)
	goji.Delete("/redir/:from", webApp.DeleteRedir)
	goji.Get("/redir/list", webApp.ListRedir)

	//_, _ = api.New(api.CallbackList{})

	goji.Serve()
}
开发者ID:efigence,项目名称:go-powerdns,代码行数:28,代码来源:powerdns-remote.go

示例8: initServer

func initServer(conf *configuration.Configuration, conn *zk.Conn, eventBus *event_bus.EventBus) {
	stateAPI := api.StateAPI{Config: conf, Zookeeper: conn}
	serviceAPI := api.ServiceAPI{Config: conf, Zookeeper: conn}
	eventSubAPI := api.EventSubscriptionAPI{Conf: conf, EventBus: eventBus}

	conf.StatsD.Increment(1.0, "restart", 1)
	// Status live information
	goji.Get("/status", api.HandleStatus)

	// State API
	goji.Get("/api/state", stateAPI.Get)

	// Service API
	goji.Get("/api/services", serviceAPI.All)
	goji.Post("/api/services", serviceAPI.Create)
	goji.Put("/api/services/:id", serviceAPI.Put)
	goji.Delete("/api/services/:id", serviceAPI.Delete)

	goji.Post("/api/marathon/event_callback", eventSubAPI.Callback)

	// Static pages
	goji.Get("/*", http.FileServer(http.Dir("./webapp")))

	registerMarathonEvent(conf)

	goji.Serve()
}
开发者ID:rthomas,项目名称:bamboo,代码行数:27,代码来源:bamboo.go

示例9: routing

func routing() {

	///// Website /////

	goji.Get("/", Index)

	/////API///////

	//inscription
	goji.Post("/api/signup", Signup)

	//connexion
	goji.Post("/api/signin", Signin)

	//creation de poste
	goji.Post("/api/post", CreatePost)

	//obtenir ses propres posts
	goji.Get("/api/post", GetOwnPosts)

	//obtenir un post par son id
	goji.Get("/api/post/:id", GetPost)

	//obtenir une liste de post par le login
	goji.Get("/api/:login/post", GetUserPosts)

	//suppresion d'un poste
	goji.Delete("/api/post/:id", DeletePost)

	//comfirmation de l'email si le fichier app.json est configuré pour
	if models.Conf.Status == "prod" || models.Conf.EmailCheck == true {
		goji.Get("/comfirmation", Comfirmation)
	}
}
开发者ID:Fantasim,项目名称:Langage-Go,代码行数:34,代码来源:main.go

示例10: InitRoutes

func InitRoutes() {
	goji.Get("/users", UserList)
	goji.Get("/users/:id", UserView)
	goji.Delete("/users/:id", UserDelete)
	goji.Post("/users", UserCreate)
	goji.Put("/users/:id", UserUpdate)
	goji.Get("/", Index)
}
开发者ID:mdennebaum,项目名称:narwhal,代码行数:8,代码来源:init.go

示例11: main

func main() {
	goji.Get("/todo", todos)
	goji.Post("/todo/newTodo", newTodo)
	goji.Get("/todo:id", getTodo)
	goji.Put("/todo:id", putTodo)
	goji.Delete("/todo:id", delTodo)
	goji.Serve()
}
开发者ID:velugu7777,项目名称:vtodos,代码行数:8,代码来源:main.go

示例12: main

func main() {
	goji.Get("/post/:id", post.HandleGet)
	goji.Post("/post", post.HandlePost)
	goji.Put("/post/:id", post.HandlePut)
	goji.Delete("/post/:id", post.HandleDelete)
	goji.Serve()

}
开发者ID:jf,项目名称:gwp,代码行数:8,代码来源:server.go

示例13: main

func main() {
	// HTTP Handlers
	goji.Post("/:topic_name", publishingHandler)
	goji.Post("/:topic_name/:subscriber_name", subscribingHandler)
	goji.Delete("/:topic_name/:subscriber_name", unsubscribingHandler)
	goji.Get("/:topic_name/:subscriber_name", pollingHandler)

	// Serve on the default :8000 port.
	goji.Serve()
}
开发者ID:pmwebster,项目名称:pubsub,代码行数:10,代码来源:main.go

示例14: defineHandlers

func defineHandlers() {
	pref := "/rest/:service/:region"
	goji.Get(pref+"/:resource", indexHandler)
	goji.Get(pref+"/:resource/:id", showHandler)
	goji.Put(pref+"/:resource/:id", updateHandler)
	goji.Post(pref+"/:resource", createHandler)
	goji.Delete(pref+"/:resource/:id", deleteHandler)
	goji.Post(pref+"/action/:action", serviceActionHandler)
	goji.Post(pref+"/:resource/action/:action", collectionActionHandler)
	goji.Post(pref+"/:resource/:id/action/:action", resourceActionHandler)
}
开发者ID:rightscale,项目名称:self-service-plugins,代码行数:11,代码来源:main.go

示例15: main

func main() {
	goji.Get("/", index)
	goji.Get("/assets/*", http.FileServer(http.Dir("./dist")))
	goji.Get("/api/todos", todos)
	goji.Post("/api/todos", newTodo)
	goji.Put("/api/todos/:id", putTodo)
	goji.Delete("/api/todos/:id", delTodo)

	goji.NotFound(index)

	goji.Serve()
}
开发者ID:velugu7777,项目名称:vtodo,代码行数:12,代码来源:main.go


注:本文中的github.com/zenazn/goji.Delete函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。