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

Path parameters #559

Open
maekoos opened this issue Aug 29, 2024 · 4 comments
Open

Path parameters #559

maekoos opened this issue Aug 29, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@maekoos
Copy link

maekoos commented Aug 29, 2024

What are you building with SQLPage ?

I am building a simple accounting platform.

What is your problem ? A description of the problem, not the solution you are proposing.

I'd like to have routes that go /app/:serviceId/, /app/:serviceId/ledger, /app/:serviceId/ledger/:accountId/info.

What are you currently doing ? Since your solution is not implemented in SQLPage currently, what are you doing instead ?
I am using query parameters, but it is quickly becoming a bit messy.

Describe the solution you'd like

There are already a tonne of filesystem routers to take inspiration from, for example:

Most of them use folders and files with [paramter-name] to add route parameters.

Describe alternatives you've considered

As mentioned, search parameters work but become a bit ugly after a while, especially since it is not possible to use relative urls to simplify links.

Route parameters would also allow someone to build a (almost) proper REST-api which would be kind of cool.

@maekoos maekoos added the enhancement New feature or request label Aug 29, 2024
@maekoos
Copy link
Author

maekoos commented Aug 29, 2024

I have also considered using a proxy server - but that feels just way too complex for such a simple feature.

When looking at how files are resolved however, I see how this could be somewhat problematic. We'd probably need to either generate a "router" from the file system on startup/file change, or resolve request paths one / at a time...

@lovasoa
Copy link
Collaborator

lovasoa commented Aug 29, 2024

Hello and welcome to SQLPage!

This feature has recently been implemented in #544 see https://sql.datapage.app/your-first-sql-website/custom_urls.sql

It will be in the next stable version!

@maekoos
Copy link
Author

maekoos commented Aug 29, 2024

Ahha! Nice - I'll give it a try, although my first impression is that it feels a bit cumbersome....

@lovasoa
Copy link
Collaborator

lovasoa commented Sep 26, 2024

Related discussion here: #584

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants