Skip to content

SQLPage as an API endpoint #806

Answered by lovasoa
Pieter3033 asked this question in Q&A
Feb 10, 2025 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

You know what, I'll build it for the next update. I've delayed that one for too long !

I'll add two functions,

  • sqlpage.request_body() that returns the body as a string (on which you can then use your database's json functions)
  • sqlpage.request_body_base64() that encodes the request body as base64, for easily storing the results, or converting it to a data-url.

example

echo_server.sql

select 'shell-empty' as component, sqlpage.request_body() as html;

result

❯ http -v 'localhost:8080/echo_server' test=42
POST /echo_server HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 14
Content-Type: application/json
Host: localhost:8080…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Pieter3033
Comment options

@lovasoa
Comment options

Answer selected by Pieter3033
@Pieter3033
Comment options

@lovasoa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants