25 lines
427 B
Go
25 lines
427 B
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"reichard.io/imagini/internal/db"
|
||
|
"reichard.io/imagini/internal/auth"
|
||
|
)
|
||
|
|
||
|
type API struct {
|
||
|
Router *http.ServeMux
|
||
|
Auth *auth.AuthManager
|
||
|
DB *db.DBManager
|
||
|
}
|
||
|
|
||
|
func NewApi(db *db.DBManager, auth *auth.AuthManager) *API {
|
||
|
api := &API{
|
||
|
Router: http.NewServeMux(),
|
||
|
DB: db,
|
||
|
Auth: auth,
|
||
|
}
|
||
|
api.registerRoutes()
|
||
|
return api
|
||
|
}
|