Reorganize & Add DB Bootstrapping

This commit is contained in:
2021-01-12 17:06:27 -05:00
parent bc3b437ebc
commit fe932de37e
7 changed files with 49 additions and 40 deletions

View File

@@ -1,11 +1,12 @@
package cmd
import (
"net/http"
"reichard.io/imagini/routes"
"reichard.io/imagini/internal/context"
"github.com/urfave/cli/v2"
"net/http"
log "github.com/sirupsen/logrus"
)
@@ -16,19 +17,11 @@ var CmdServe = cli.Command{
Action: serveWeb,
}
// var CmdDBTest = cli.Command{
// Name: "test",
// Aliases: []string{"t"},
// Usage: "test db.",
// Action: testDatabase,
// }
func serveWeb(cliCtx *cli.Context) error {
log.Info("Serving Web")
ctx := context.NewImaginiContext()
routes.RegisterRoutes(ctx)
//listener, _ := net.Listen("tcp", ctx.Config.ListenPort)
if err := http.ListenAndServe(":" + ctx.Config.ListenPort, nil); err != nil {
log.Fatal(err)