This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/cmd/cmd.go

25 lines
437 B
Go
Raw Normal View History

2021-01-03 03:21:11 +00:00
package cmd
import (
2021-01-03 22:31:16 +00:00
"reichard.io/imagini/routes"
"github.com/urfave/cli/v2"
"net/http"
"log"
2021-01-03 03:21:11 +00:00
)
var CmdServe = cli.Command{
2021-01-03 22:31:16 +00:00
Name: "serve",
Aliases: []string{"s"},
Usage: "Start Imagini web server.",
Action: serveWeb,
2021-01-03 03:21:11 +00:00
}
func serveWeb(ctx *cli.Context) error {
2021-01-03 22:31:16 +00:00
routes.RegisterRoutes()
if err := http.ListenAndServe(":8080", nil); err != nil {
log.Fatal(err)
}
2021-01-03 03:21:11 +00:00
return nil
}