mirror of
https://github.com/zoriya/cish.git
synced 2025-12-06 07:16:16 +00:00
43 lines
710 B
Go
43 lines
710 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
type Handler struct {
|
|
db *pgxpool.Pool
|
|
}
|
|
|
|
func (h Handler) CreateOci(c echo.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (h Handler) CreateSubJob(c echo.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
|
|
dbpool, err := pgxpool.New(ctx, os.Getenv("DATABASE_URL"))
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
defer dbpool.Close()
|
|
|
|
// go Listener(ctx, dbpool)
|
|
|
|
h := Handler{dbpool}
|
|
|
|
e := echo.New()
|
|
e.PUT("/job/:uid/oci", h.CreateOci)
|
|
e.PUT("/job/:uid/job", h.CreateSubJob)
|
|
e.Logger.Fatal(e.Start(":5677"))
|
|
}
|