Simplify development workflow and fix content editing conflicts
- Replace complex multi-server setup (live-server + API) with unified Go server
- Serve all sites at /sites/{site_id} endpoints, eliminating port conflicts
- Fix content-type middleware to serve proper MIME types for static files
- Prevent script injection duplication with future-proof CDN-compatible detection
- Remove auto page reload from enhance button to eliminate editing interruptions
- Enable seamless content editing workflow with manual enhancement control
Development now requires only 'just dev' instead of complex demo commands.
All sites immediately available at localhost:8080 without hot reload conflicts.
This commit is contained in:
@@ -57,8 +57,11 @@ func (rw *responseWriter) WriteHeader(code int) {
|
||||
// ContentTypeMiddleware ensures JSON responses have proper content type
|
||||
func ContentTypeMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// Set default content type for API responses
|
||||
if r.URL.Path != "/" && (r.Method == "GET" || r.Method == "POST" || r.Method == "PUT") {
|
||||
// Set default content type for API responses only, not static sites
|
||||
if r.URL.Path != "/" &&
|
||||
!strings.HasPrefix(r.URL.Path, "/sites/") &&
|
||||
!strings.HasPrefix(r.URL.Path, "/insertr.js") &&
|
||||
(r.Method == "GET" || r.Method == "POST" || r.Method == "PUT") {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user