Skip to content

Add support for optional params#631

Merged
ryansolid merged 1 commit intosolidjs:mainfrom
ghalle:feat/optional-param
Jan 9, 2023
Merged

Add support for optional params#631
ryansolid merged 1 commit intosolidjs:mainfrom
ghalle:feat/optional-param

Conversation

@ghalle
Copy link
Copy Markdown
Collaborator

@ghalle ghalle commented Jan 7, 2023

This PR adds support for optional params to the file system routing.

The syntax chosen is [[param]], the first set of square brackets indicate that it is a parameter and the second set indicate that it is optional.
This syntax was chosen because ? is not a valid character in filenames on Windows.

Usage example:

src/routes/[[lang]]/blog/test.tsx

path params
/blog/test {}
/en/blog/test { lang: "en" }

@ryansolid
Copy link
Copy Markdown
Member

Thanks. This has been overdue. I was thinking about it just the other day.

@ryansolid ryansolid merged commit 9ac27ac into solidjs:main Jan 9, 2023
@jchatard
Copy link
Copy Markdown
Contributor

jchatard commented Jan 9, 2023

Hi @ryansolid somewhat related to this PR just in case you didn’t see it: solidjs/solid-router#227

Thanks.

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

Successfully merging this pull request may close these issues.

3 participants