mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-05-28 14:23:12 +00:00
Add run commands
This commit is contained in:
parent
ac0a8df205
commit
4318b3ed47
5 changed files with 80 additions and 19 deletions
26
api/api.go
Normal file
26
api/api.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"github.com/Fluffy-Bean/TastyBites/front"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Host string
|
||||
Logging bool
|
||||
}
|
||||
|
||||
func Serve(c Config) {
|
||||
r := echo.New()
|
||||
|
||||
if c.Logging {
|
||||
r.Use(middleware.Logger())
|
||||
}
|
||||
r.Use(middleware.Recover())
|
||||
|
||||
r.StaticFS("/", front.DistDir)
|
||||
|
||||
r.HideBanner = true
|
||||
r.Logger.Fatal(r.Start(c.Host))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue