tt_goji_middleware

package module
v0.0.0-...-a4dd944 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 3 Imported by: 0

README

Some Goji middleware

Some simple Goji middleware I've found useful. Find the documentation at http://godoc.org/github.com/philpearl/tt_goji_middleware.

Build Status GoDoc

The middleware is arranged in packages based on external dependencies

  • base has no external dependencies except Goji
  • postgres depends on github.com/lib/pq
  • raven depends on github.com/kisielk/raven-go/raven
  • redis depends on github.com/garyburd/redigo/redis

Just go get the sub-packages you need.

What's included

In base:

  • Set something in Context for all requests. For example global configuration or a database connection pool
  • Error catching and reporting
  • Logging ('fraid I don't like the Goji version)
  • A very simple GZIP
  • Strip a prefix from the url
  • Session middleware.

In postgres:

  • A postgres based session store for the base session middleware

In raven:

  • Catch panics, log them, send responses and report them to Sentry

In redis:

  • Ensure there's a redis connection in c.Env["redis"]. Connections come from a pool and are not opened until used.
  • A Redis based rate limiter that issues a single command to Redis per request.
  • A Redis based session store for the base session middleware

Contributing

Pull requests are more than welcome!

Documentation

Overview

Package tt_goji_middleware contains some simple middleware for Goji

Middleware is arranged into sub-packages based on their external dependencies.

Directories

Path Synopsis
Package base contains middleware that has no external dependencies except Goji
Package base contains middleware that has no external dependencies except Goji
Package postgres contains code that depends on a Postgresql database backend, and github.com/lib/pq
Package postgres contains code that depends on a Postgresql database backend, and github.com/lib/pq
Package raven contains middleware than depends on github.com/kisielk/raven-go/raven
Package raven contains middleware than depends on github.com/kisielk/raven-go/raven
Package redis contains middleware that depends on github.com/garyburd/redigo/redis
Package redis contains middleware that depends on github.com/garyburd/redigo/redis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL