package database

import (
	"github.com/go-martini/martini"
	"log"
	"net/http"
)

// The Martini handler to use for injecting the database context
func Middleware() martini.Handler {
	db, err := OpenAndInit()

	if err != nil {
		log.Fatal(err)
	}

	return func(w http.ResponseWriter, r *http.Request, c martini.Context) {
		c.Map(db)
	}
}

package database

import (
	"github.com/go-martini/martini"
	"log"
	"net/http"
)

// The Martini handler to use for injecting the database context
func Middleware() martini.Handler {
	db, err := OpenAndInit()

	if err != nil {
		log.Fatal(err)
	}

	return func(w http.ResponseWriter, r *http.Request, c martini.Context) {
		c.Map(&db)
	}
}

Revert "Accidentally was giving it the pointer to a pointer."
Revert "Accidentally was giving it the pointer to a pointer."

This reverts commit bbf3f7b3cc797b563b0670d552635df4fd613637.
