fastpastebin/api/http/exported.go

28 lines
493 B
Go
Raw Normal View History

2018-04-30 18:42:17 +05:00
package http
import (
// local
"github.com/pztrn/fastpastebin/api/http/static"
"github.com/pztrn/fastpastebin/context"
// other
"github.com/labstack/echo"
)
var (
c *context.Context
)
// New initializes basic HTTP API, which shows only index page and serves
// static files.
2018-04-30 18:42:17 +05:00
func New(cc *context.Context) {
c = cc
c.Logger.Info().Msg("Initializing HTTP API...")
// Static files.
c.Echo.GET("/static/*", echo.WrapHandler(static.Handler))
// Index.
c.Echo.GET("/", indexGet)
}