Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Routing like NextJS #331

@jerrygreen

Description

@jerrygreen

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions