當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Echo.Use方法代碼示例

本文整理匯總了Golang中github.com/labstack/echo.Echo.Use方法的典型用法代碼示例。如果您正苦於以下問題:Golang Echo.Use方法的具體用法?Golang Echo.Use怎麽用?Golang Echo.Use使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/labstack/echo.Echo的用法示例。


在下文中一共展示了Echo.Use方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: InitializeRenderers

func InitializeRenderers(e *echo.Echo) error {
	//e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.SetRenderer(&EchoRenderer{})

	e.GET("/static*", RenderStatic)

	return nil
}
開發者ID:boundedinfinity,項目名稱:bi-echo,代碼行數:9,代碼來源:renderers.go

示例2: loadHandlers

func loadHandlers(e *echo.Echo) {

	if itrak.Debug {
		e.SetDebug(true)
	}

	// Point to the client application generated inside the webapp dir
	e.Index("./webapp/build/index.html")
	e.ServeDir("/", "./webapp/build/")

	server_stats = stats.New()
	e.Use(server_stats.Handler)

	e.Get("/stats", getStats)
	e.Get("/test1", getTestData)
	e.Get("/part", getPartsList)
	e.Get("/task", getTaskList)
	e.Get("/jtask", getJTaskList)

	e.Post("/login", login)
	e.Delete("/login", logout)

	e.Get("/people", getPeople)
	e.Get("/people/:id", getPerson)
	e.Post("/people/:id", savePerson)

	e.Get("/site", getSites)
	e.Get("/site/:id", getSite)
	e.Post("/site/:id", saveSite)

	e.Get("/roles", getRoles)

	e.Get("/vendors", getAllVendors)
	e.Post("/vendors/:id", saveVendor)

	// Equipment Related functions
	e.Get("/equipment", getAllEquipment)
	e.Get("/site_equipment/:id", getAllSiteEquipment)
	e.Get("/equipment/:id", getEquipment)
	e.Post("/equipment/:id", saveEquipment)
	e.Get("/subparts/:id", subParts)
	e.Get("/spares", getAllSpares)
	e.Get("/spares/:id", getEquipment)
	e.Post("/spares/:id", saveEquipment)
	e.Get("/consumables", getAllConsumables)
	e.Get("/consumables/:id", getEquipment)
	e.Post("/consumables/:id", saveEquipment)

	e.Get("/equiptype", getAllEquipTypes)
	e.Get("/equiptype/:id", getEquipType)
	e.Post("/equiptype/:id", saveEquipType)

	e.Get("/task", getAllTask)
	e.Get("/sitetask/:id", getSiteTasks)
	e.Get("/task/:id", getTask)
	e.Post("/task/:id", saveTask)
}
開發者ID:steveoc64,項目名稱:itrak.mmaint,代碼行數:57,代碼來源:handlers.go

示例3: Init

func Init(e *echo.Echo, Debug bool) {
	c := cors.New(cors.Options{
		AllowedOrigins:   []string{"*"},
		AllowedMethods:   []string{"GET", "POST", "DELETE", "PUT", "PATCH"},
		AllowCredentials: true,
		Debug:            Debug,
	})
	e.Use(standard.WrapMiddleware(c.Handler))
}
開發者ID:steveoc64,項目名稱:godev,代碼行數:9,代碼來源:echocors.go

示例4: OnStart

// OnStart ...
func (s *Server) OnStart(c *common.Config, e *echo.Echo) error {
	go func() { s.sessionMgnt.Start() }()

	e.Use(middleware.BasicAuth(s.Auth))
	e.POST("/api/v1/server/tasks", s.CreateTask)
	e.DELETE("/api/v1/server/tasks/:id", s.CancelTask)
	e.GET("/api/v1/server/tasks/:id", s.QueryTask)
	e.POST("/api/v1/server/tasks/status", s.ReportTask)

	return nil
}
開發者ID:xtfly,項目名稱:gofd,代碼行數:12,代碼來源:server.go

示例5: Init

func Init(e *echo.Echo) {
	e.Use(middleware.Static("node_modules"))

	if env := os.Getenv("GO_ENV"); env == "" {
		e.Use(middleware.Static("client/dev"))
	} else {
		e.Use(middleware.Static("client/dist"))
	}
}
開發者ID:bgdsh,項目名稱:playground,代碼行數:9,代碼來源:static.go


注:本文中的github.com/labstack/echo.Echo.Use方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。