Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http server and server connnector to expose restful api #6

Open
pi0 opened this issue May 10, 2023 · 10 comments
Open

http server and server connnector to expose restful api #6

pi0 opened this issue May 10, 2023 · 10 comments

Comments

@pi0
Copy link
Member

pi0 commented May 10, 2023

Similar to unstorage server this would allow exposing sql backends as a restful API to edge runtime 🐦

@amandesai01
Copy link
Contributor

Is this up for grabs? I am open to implement it.

@pi0
Copy link
Member Author

pi0 commented Oct 24, 2024

Surely @amandesai01 feel free to open a draft if you like! (i can continue on top of your work then in same PR)

@amandesai01
Copy link
Contributor

Can I get some initial spec (need not be detailed)

Basically what will be input vs output?

@amandesai01
Copy link
Contributor

For now, this is what I believe is expected:
One endpoint to take SQL query and prepared statements, and return result as JSON.

What else?

@amandesai01
Copy link
Contributor

So here is spec according to me: (I maybe wrong at what at all is expected):

  • GET endpoint - It will run db.prepare().all() method and return the rows.
  • POST endpoint - It will run db.prepare().exec() method and return { success: boolean }

Is that what is expected? or something else?

@atinux
Copy link
Member

atinux commented Dec 3, 2024

@pi0
Copy link
Member Author

pi0 commented Dec 3, 2024

Yep, but more i'm thinking to expose remote RPC as raw/unprepared queries rather than CRUD verbs. Any higher over layer usage can then extend server to build something similar but their own parsing and conventions.

@amandesai01
Copy link
Contributor

amandesai01 commented Dec 5, 2024

Can you show some sample implementation / links? @pi0

Edit:
I believe this is what you mean: https://starbasedb.hashnode.space/default-guide/http-endpoints/query
Implementation: https://github.com/Brayden/starbasedb/blob/main/src/operation.ts

cc: @atinux

@pi0
Copy link
Member Author

pi0 commented Dec 5, 2024

It is a new idea/API here so I don't have an example to share.. But I will try to draft something as soon as had little time to move it forward :)

@sandros94
Copy link

It is a new idea/API here so I don't have an example to share.. But I will try to draft something as soon as had little time to move it forward :)

I theory we could also have multiple implementation right? I'm still not fully sure if I understand what I'm reading around, but something like a crosswire (much like crossws and y-crossws) based on Supabase's pg-gateway should be possible right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants