Express for Go

github.com/malcolmston/express

Fast, unopinionated, minimalist web framework.

 GitHubports expressjs/express

Routing, middleware chains, views, content negotiation and streaming — the Express you know, in Go. The same three-argument handler signature, path patterns (:param, :id?, :id(\\d+), *), and mountable routers.

Install

shell
$ go get github.com/malcolmston/express

Quick start

main.go
app := express.New()

app.Get("/users/:id", func(req *express.Request,
    res *express.Response, next express.Next) {
    res.JSON(map[string]any{"id": req.Params("id")})
})

app.Listen(":3000")

Features

  • Handlers with the classic (req, res, next) shape
  • Path-to-regexp params: :id, optional :id?, regex :id(\d+), wildcard *
  • Routers with CaseSensitive / Strict / MergeParams options
  • Views via html/template, res.Render / res.SendFile
  • Content negotiation, SSE & chunked streaming, the new QUERY HTTP method
  • Batteries: 100+ middleware + utility ports (ms, bytes, cookie, qs, jsonwebtoken, uuid, lodash/* …)
  • express.WrapHandler mounts any net/http handler
Express