feature: add web & migrate commands

This commit is contained in:
Jordan Knott
2020-07-15 18:20:08 -05:00
parent 1e9813601e
commit 90515f6aa4
31 changed files with 1300 additions and 640 deletions

View File

@@ -5,13 +5,27 @@ import (
"encoding/json"
"io/ioutil"
"net/http"
"os"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"time"
"github.com/jordanknott/project-citadel/api/internal/db"
"github.com/jordanknott/project-citadel/api/internal/frontend"
)
func (h *CitadelHandler) Frontend(w http.ResponseWriter, r *http.Request) {
f, err := frontend.Frontend.Open("index.h")
if os.IsNotExist(err) {
log.Warning("does not exist")
} else if err != nil {
log.WithError(err).Error("frontend")
}
http.ServeContent(w, r, "index.html", time.Now(), f)
}
func (h *CitadelHandler) ProfileImageUpload(w http.ResponseWriter, r *http.Request) {
log.Info("preparing to upload file")
userID, ok := r.Context().Value("userID").(uuid.UUID)