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

Programmatically/dynamically define pages #1691

Open
OrangeTimes opened this issue Jun 12, 2024 · 9 comments
Open

Programmatically/dynamically define pages #1691

OrangeTimes opened this issue Jun 12, 2024 · 9 comments
Labels
enhancement ✨ New feature or request

Comments

@OrangeTimes
Copy link

OrangeTimes commented Jun 12, 2024

Description

Current Vike API doesn't provide any way how to programmatically create a custom file route for situations when +Page.ts or +Page.js are created externally on the filesystem or in another dynamic fashion.

Addendum by brillout

This feature will be implemented at some point as we want Vike extensions to be able to define pages. (Important for one of Vike's vision.)

Other use cases:

@OrangeTimes OrangeTimes added the enhancement ✨ New feature or request label Jun 12, 2024
@brillout
Copy link
Member

Use case: #1661.

@OrangeTimes I don't think there is any React/Vue/Solid(/...) framework out there that supports this?

@brillout brillout changed the title Add ability to programatically define a file route Programmatically/dynamically define pages Jun 12, 2024
@OrangeTimes
Copy link
Author

Yes, Next.Js and other similar frameworks don't support this at the moment

@doeixd
Copy link

doeixd commented Jun 12, 2024

@brillout
Copy link
Member

brillout commented Jun 12, 2024 via email

@doeixd
Copy link

doeixd commented Jun 12, 2024

I edited the post with some docs links. Sorry

@brillout
Copy link
Member

Thank you!

@OrangeTimes
Copy link
Author

This is possible with Solid Start and Nuxt. I think

https://nuxt.com/docs/guide/recipes/custom-routing

https://docs.solidjs.com/solid-start/building-your-application/routing#additional-route-config (FilesystemRoutes component returns an object which you can add to)

https://remix.run/docs/en/main/discussion/routes#manual-route-configuration

Correct me if I'm wrong, but in Remix it will be evaluated one time and not on each request. If I need to push a new file route on some incoming request condition (create a file route on the fly) this will not work most probably.

@doeixd
Copy link

doeixd commented Jun 13, 2024

Thats correct.

For your use case, I'd suggest just using a client side router (Whose routes can be added to on the server / client) + a backend service that you write that will ssr the pages manually.

@OrangeTimes
Copy link
Author

We currently have a very custom and quite old SSR server. If there was a way to create file routes on the fly using onBeforeRoute for example it would drastically simplify things for us and our existing setup and would unblock us from adopting Vike potentially.

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

3 participants