wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.34k stars 1.18k forks source link

Smart URL/route params #262

Open Martinsos opened 3 years ago

Martinsos commented 3 years ago

Have them be pre-parsed / typed, so that the developer can be sure that received parameter is indeed what it expected. Maybe worth waiting for TypeScript support for Wasp?

This feature requires some research on how to do it exactly.

It will require expanding Wasp language.

Redwood is doing something similar so that might be worth looking at, I think RoR might be doing something similar also.

Martinsos commented 1 year ago

So there are two things here:

  1. Provide a special React Component, e.g. Link, that ensures via TypeScript that only existing routes can be addressed via it.
  2. Allow typing of route parameters. Something like /tasks/:id::int/subtasks. So basically you can provide this ::int part. Could be done via Wasp's DSL, or maybe some other way. Redwood has something here already, their own small DSL for it, so worth checking out. RoR also does something similar I think. Also, tanstack router already has some support for this -> maybe worth switching to them and using what they have here.
sodic commented 1 month ago

The first part is done, right @infomiho? The second one is probably covered by another issue that talks about routers. Perhaps you know it right of the bat.