25 lines
437 B
Go
25 lines
437 B
Go
package cmd
|
|
|
|
import (
|
|
"reichard.io/imagini/routes"
|
|
"github.com/urfave/cli/v2"
|
|
"net/http"
|
|
"log"
|
|
)
|
|
|
|
var CmdServe = cli.Command{
|
|
Name: "serve",
|
|
Aliases: []string{"s"},
|
|
Usage: "Start Imagini web server.",
|
|
Action: serveWeb,
|
|
}
|
|
|
|
func serveWeb(ctx *cli.Context) error {
|
|
routes.RegisterRoutes()
|
|
|
|
if err := http.ListenAndServe(":8080", nil); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return nil
|
|
}
|