Thursday, October 8, 2015

labstack echo - nice http server in go

The echo http server is pretty nice even though it's missing a feature or two.

  • I would like to be able to serve assets directly from go-bindata's assetfs
  • setting a root path without it being a path substitution
  • missing ServeContent()

func main() {
        flag.Parse()

        // Echo instance
        e := echo.New()

        // Middleware
        e.Use(mw.Logger())
        e.Use(mw.Recover())

        e.Static("/public", "www/public")
        // Routes
        e.Index("public/index.html")
        e.ServeFile("/welcome", "welcome.html")
        e.ServeFile("/styles.css", "styles.css")
        e.Get("/a", hello)

        // Start server
        log.Printf("Listening to port: %v", *bindto)
        e.Run(*bindto)
}

Some good stuff
  • fast
  • zero stack
  • websockets
  • JWT (even though I do not trust it)
  • graceful shutdown

No comments:

Post a Comment

dead pixels

I have never had a dead pixel so when I read: Small numbers (1-3) of stuck or dead pixels are a characteristic of LCD screens. These are n...