func New(conf *Config) http.Handler {
	go ratelimit()
	cfg = conf
	log = cfg.Logger
	err := os.MkdirAll(cfg.BasePath, 644)
	if err != nil {
		log.Fatal(err)
	}
	r := chi.NewRouter()
	r.Use(func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			r = r.WithContext(context.WithValue(r.Context(), "logger",
				log.WithFields(logrus.Fields{
					"ip":         r.RemoteAddr,
					"user-agent": r.UserAgent(),
				})))
			next.ServeHTTP(w, r)
		})
	})
	r.Post("/upload", upload)
	r.Get("/:file", serveFile)
	if cfg.UploadPage {
		templ = template.Must(template.ParseFiles("upload.html"))
		r.Get("/", uploadPage)
	} else {
		r.Get("/", http.NotFound)
	}
	return r
}
New initializes a http Handler and returns it
package filehost
import (
	"context"
	"html/template"
	"io"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"
	"mime"
	"github.com/pressly/chi"
	"github.com/sirupsen/logrus"
)
var log logrus.FieldLogger = logrus.StandardLogger()
var cfg *Config
var templ *template.Template
type Database interface {
	GetFileInfo(string) *FileInfo
	SaveFileInfo(*FileInfo)
}
type Config struct {
	AllowedMimeTypes []string
	BasePath         string
	BaseURL          string
	UploadPage       bool
	ExposedPassword  string
	NewFileName      func() string
	DB               Database
	Authenticate     func(*http.Request) bool
	AllowFileName    func(*http.Request) bool
	Logger           logrus.FieldLogger
}
type FileInfo struct {
	Name     string  
	Path     string
	MimeType string
	Uploader interface{}  
	Time     time.Time
	Expire   time.Duration
	Clicks   int
}