refact!: project structure
Some checks failed
Build and Deploy Go App / build (push) Failing after 4m35s
Build and Deploy Go App / deploy (push) Has been skipped

This commit is contained in:
nihonium 2025-10-25 21:05:16 +03:00
parent fd0ca4411b
commit db53ae04e3
Signed by: nihonium
GPG key ID: 0251623741027CFC
26 changed files with 971 additions and 6395 deletions

View file

@ -3,12 +3,13 @@ package main
import (
"context"
"fmt"
"nyanimedb-server/api"
"nyanimedb-server/db"
sqlc "nyanimedb/sql"
"os"
"reflect"
"time"
oapi "nyanimedb/api"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/jackc/pgx/v5"
@ -39,9 +40,9 @@ func main() {
r := gin.Default()
queries := db.New(conn)
queries := sqlc.New(conn)
server := api.NewServer(queries)
server := NewServer(queries)
// r.LoadHTMLGlob("templates/*")
r.Use(cors.New(cors.Config{
@ -53,10 +54,10 @@ func main() {
MaxAge: 12 * time.Hour,
}))
api.RegisterHandlers(r, api.NewStrictHandler(
oapi.RegisterHandlers(r, oapi.NewStrictHandler(
server,
// сюда можно добавить middlewares, если нужно
[]api.StrictMiddlewareFunc{},
[]oapi.StrictMiddlewareFunc{},
))
// r.GET("/", func(c *gin.Context) {
// c.HTML(http.StatusOK, "index.html", gin.H{