Files
pages/internal/server/handlers_new.go
T
2026-05-19 21:30:42 +09:00

42 lines
408 B
Go

package server
import (
"fmt"
"net/http"
"time"
)
func (s *Server) handleNewPage(
w http.ResponseWriter,
r *http.Request,
) {
draftPath := fmt.Sprintf(
"/draft/%d",
time.Now().UnixNano(),
)
_, err :=
s.store.CreateObject(
draftPath,
)
if err != nil {
http.Error(
w,
err.Error(),
500,
)
return
}
http.Redirect(
w,
r,
"/e"+draftPath,
http.StatusFound,
)
}