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

Routing like NextJS #331

Open
jerrygreen opened this issue Feb 28, 2021 · 0 comments
Open

Routing like NextJS #331

jerrygreen opened this issue Feb 28, 2021 · 0 comments

Comments

@jerrygreen
Copy link

jerrygreen commented Feb 28, 2021

There's a popular framework NextJS, it's also a web dev server to making static web applications (so in production you get just statics), but it allows you to use quite cool routing system where file tree translates into actual routes in browser, while bringing performance of a Single Page Application (because browser doesn't actually load a whole page, like in 2008, but loads little json files related to a page, and replaces the content on fly, - like in a typical SPA, but routes aren't stored in a single file like in react-router, and file system is used for that, - which is much more convenient):

src/pages/index.tsx -> /
src/pages/some_page.tsx -> /some_page
src/pages/users/[id].tsx -> /users/1, /users/2, /users/3, etc
src/pages/users/[id]/dashboard.tsx -> /users/1/dashboard, /users/2/dashboard, /users/3/dashboard, etc

But unfortunatelly NextJS doesn't allow to import .as files directly, so I'd like to use Zwitterion with NextJS actually, - so I can easily import AssemblyScript from my components (instead of having some build pipeline AssemblyScript -> WASM), yet I can have this precious routing system... But it seems it's not so easily possible.

Alternatively, it would be cool to have exact same way to handle routes like NextJS, though not using NextJS directly (maybe use a library that they use for handling routes???)

If anyone tried to tie it both together and resulted into something working, please let me know!

@jerrygreen jerrygreen changed the title Zwitterion + NextJS Routing Feb 28, 2021
@jerrygreen jerrygreen changed the title Routing Routing like NextJS Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant