Move source file to the root of pkg

I do not yet know how i will need to organize them, if indeed i need to
organize them to a finer granularity than single files, so there is no
point on doing Java-like packages.
This commit is contained in:
jordi fita mas 2023-01-17 10:40:22 +01:00
parent 6d48aa6630
commit 989cdd7da7
3 changed files with 5 additions and 6 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/jackc/pgx/v4/pgxpool" "github.com/jackc/pgx/v4/pgxpool"
"dev.tandem.ws/tandem/numerus/pkg/router" numerus "dev.tandem.ws/tandem/numerus/pkg"
) )
func main() { func main() {
@ -23,7 +23,7 @@ func main() {
srv := http.Server{ srv := http.Server{
Addr: ":8080", Addr: ":8080",
Handler: router.NewRouter(dbpool), Handler: numerus.NewRouter(dbpool),
ReadTimeout: 5 * time.Second, ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second,
IdleTimeout: 2 * time.Minute, IdleTimeout: 2 * time.Minute,

View File

@ -1,4 +1,4 @@
package logger package pkg
import ( import (
"log" "log"

View File

@ -1,4 +1,4 @@
package router package pkg
import ( import (
"context" "context"
@ -6,7 +6,6 @@ import (
"log" "log"
"net/http" "net/http"
"dev.tandem.ws/tandem/numerus/pkg/logger"
"github.com/jackc/pgx/v4/pgxpool" "github.com/jackc/pgx/v4/pgxpool"
) )
@ -47,6 +46,6 @@ func NewRouter(db *pgxpool.Pool) http.Handler {
} }
}) })
var handler http.Handler = router var handler http.Handler = router
handler = logger.Logger(handler) handler = Logger(handler)
return handler return handler
} }