feat: initial auth service support
This commit is contained in:
parent
6ed47b667c
commit
bbe57e07d5
10 changed files with 938 additions and 1 deletions
38
modules/auth/main.go
Normal file
38
modules/auth/main.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
auth "nyanimedb/auth"
|
||||
handlers "nyanimedb/modules/auth/handlers"
|
||||
sqlc "nyanimedb/sql"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var AppConfig Config
|
||||
|
||||
func main() {
|
||||
r := gin.Default()
|
||||
|
||||
var queries *sqlc.Queries = nil
|
||||
|
||||
server := handlers.NewServer(queries)
|
||||
|
||||
r.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"*"}, // allow all origins, change to specific domains in production
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
MaxAge: 12 * time.Hour,
|
||||
}))
|
||||
|
||||
auth.RegisterHandlers(r, auth.NewStrictHandler(
|
||||
server,
|
||||
[]auth.StrictMiddlewareFunc{},
|
||||
))
|
||||
|
||||
r.Run(":8082")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue