Removes internal api package

This commit is contained in:
Dennis Schoepf 2024-04-26 22:46:31 +02:00
parent ce5ee0fbd7
commit c65e239b68
3 changed files with 0 additions and 96 deletions

View file

@ -1,31 +0,0 @@
package api
import (
"errors"
"os"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/keyauth"
)
func Setup(app *fiber.App) error {
apiKey := os.Getenv("API_KEY")
if apiKey == "" {
return errors.New("Could not read API_KEY from ENV file.")
}
api := app.Group("/api", keyauth.New(keyauth.Config{
SuccessHandler: successHandler,
ErrorHandler: errHandler,
KeyLookup: "header:x-api-key",
ContextKey: "apiKey",
Validator: apiKeyValidator(apiKey),
}))
v1 := api.Group("/v1")
v1.Get("/users", FetchAllUsersHandler)
return nil
}