serve static files and docker
This commit is contained in:
@@ -2,6 +2,8 @@ package morningalarm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -17,6 +19,16 @@ type AlarmPatch struct {
|
||||
}
|
||||
|
||||
func (ma *MorningAlarm) setupWebserver() {
|
||||
|
||||
// TODO: This is stupid
|
||||
execPath, err := os.Executable()
|
||||
if err != nil {
|
||||
panic("Shit")
|
||||
}
|
||||
|
||||
// Serve static files
|
||||
ma.ro.NoRoute(gin.WrapH(http.FileServer(http.Dir(filepath.Join(filepath.Dir(execPath), "public")))))
|
||||
|
||||
// Create a new alarm
|
||||
ma.ro.POST("/api/alarm", func(c *gin.Context) {
|
||||
var body alarm
|
||||
|
||||
Reference in New Issue
Block a user