This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/internal/api/api.go

28 lines
537 B
Go
Raw Normal View History

2021-01-16 22:00:17 +00:00
package api
import (
"net/http"
"reichard.io/imagini/internal/db"
"reichard.io/imagini/internal/auth"
2021-01-22 05:00:55 +00:00
"reichard.io/imagini/internal/config"
2021-01-16 22:00:17 +00:00
)
type API struct {
Router *http.ServeMux
2021-01-22 05:00:55 +00:00
Config *config.Config
2021-01-16 22:00:17 +00:00
Auth *auth.AuthManager
DB *db.DBManager
}
2021-01-22 05:00:55 +00:00
func NewApi(db *db.DBManager, c *config.Config, auth *auth.AuthManager) *API {
2021-01-16 22:00:17 +00:00
api := &API{
2021-01-18 04:56:56 +00:00
Router: http.NewServeMux(),
2021-01-22 05:00:55 +00:00
Config: c,
2021-01-18 04:56:56 +00:00
Auth: auth,
DB: db,
2021-01-16 22:00:17 +00:00
}
api.registerRoutes()
return api
}