chore: migrate to standard layout (#5)

See: https://github.com/golang-standards/project-layout
Reviewed-on: https://code.alt-gnome.ru/aides-infra/aides-repo-api/pulls/5
Co-authored-by: Maxim Slipenko <no-reply@maxim.slipenko.com>
Co-committed-by: Maxim Slipenko <no-reply@maxim.slipenko.com>
This commit is contained in:
Максим Слипенко 2024-12-12 07:47:17 +00:00 committed by Максим Слипенко
parent 64d68bf555
commit d02e0d122c
4 changed files with 13 additions and 10 deletions

View file

@ -1,11 +1,13 @@
package main package main
import ( import (
"github.com/caarlos0/env/v11"
"log" "log"
"net/http" "net/http"
"rest_api/models"
"rest_api/router" "code.alt-gnome.ru/aides-infra/aides-repo-api/internal/models"
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/router"
"github.com/caarlos0/env/v11"
) )
func main() { func main() {
@ -18,5 +20,4 @@ func main() {
log.Printf("Сервер запущен на порту: %s", config.Port) log.Printf("Сервер запущен на порту: %s", config.Port)
http.ListenAndServe(":"+config.Port, router) http.ListenAndServe(":"+config.Port, router)
} }

11
go.mod
View file

@ -1,10 +1,11 @@
module rest_api module code.alt-gnome.ru/aides-infra/aides-repo-api
go 1.23.3 go 1.23.3
require ( require (
github.com/ajg/form v1.5.1 // indirect github.com/caarlos0/env/v11 v11.2.2
github.com/caarlos0/env/v11 v11.2.2 // indirect github.com/go-chi/chi/v5 v5.1.0
github.com/go-chi/chi/v5 v5.1.0 // indirect github.com/go-chi/render v1.0.3
github.com/go-chi/render v1.0.3 // indirect
) )
require github.com/ajg/form v1.5.1 // indirect

View file

@ -7,9 +7,10 @@ import (
"net/http" "net/http"
"os" "os"
"path" "path"
"rest_api/models" // Импорт пакета с моделями, где определены структуры конфигурации
"strconv" "strconv"
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/models"
"github.com/go-chi/render" "github.com/go-chi/render"
"github.com/go-chi/chi/v5" //Импорт пакета chi для маршрутизации "github.com/go-chi/chi/v5" //Импорт пакета chi для маршрутизации