An experimental web framework where PostgreSQL does everything: routing, HTML, file storage, jobs and sessions.
add_code_link.sql · 1.4 KB · 33 lines
| 1 | -- Add /code link to homepage |
| 2 | -- This finds the handle_request function in code_files and updates it |
| 3 | |
| 4 | -- First, let's update the stored handle_request function to add the code editor link |
| 5 | UPDATE code_files |
| 6 | SET content = regexp_replace( |
| 7 | content, |
| 8 | '(<div class="card">\s+<h2>🚀 API Endpoints</h2>)', |
| 9 | E'<div class="card"> |
| 10 | <h2>🔥 Hot Deploy Code Editor</h2> |
| 11 | <div class="endpoint"> |
| 12 | <span class="method GET">GET</span> |
| 13 | <span class="path">/code</span> |
| 14 | <div class="description">Live code editor - Edit functions while the server is running!</div> |
| 15 | </div> |
| 16 | <div style="margin-top: 20px;"> |
| 17 | <a href="/code" style="display: inline-block; background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%); color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: transform 0.2s;">🔥 Open Code Editor</a> |
| 18 | </div> |
| 19 | </div> |
| 20 | |
| 21 | \\1', |
| 22 | 'g' |
| 23 | ), |
| 24 | version = version + 1, |
| 25 | updated_at = now() |
| 26 | WHERE path = 'functions/handle_request.sql' |
| 27 | AND content NOT LIKE '%Hot Deploy Code Editor%'; -- Only update if not already added |
| 28 | |
| 29 | -- Now hot reload the function |
| 30 | SELECT hot_reload('functions/handle_request.sql'); |
| 31 | |
| 32 | -- Return status |
| 33 | SELECT 'Code editor link added to homepage!' as result; |