Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Optional param, slash in address #22

Open
lishine opened this issue May 17, 2019 · 1 comment
Open

Optional param, slash in address #22

lishine opened this issue May 17, 2019 · 1 comment

Comments

@lishine
Copy link

lishine commented May 17, 2019

router.add({
    name: 'register',
    pattern: '/register/:barcode?',
    page: '/register',
})

doing

router.replaceRoute('register', {}, { shallow: true })

resulting in an address:

http://localhost:3000/register/

Is it intentional ?
Though it is working, I would like the address to not include the slash: http://localhost:3000/register
How to achieve this? Need change in the package source?

@gvergnaud
Copy link
Owner

Hey,

Sorry for answering this late, I didn't have much time recently to take care of this.

I agree removing the trailing slash would be cleaner, and I think it does necessitate some changes in the package code. It shouldn't be too hard though :) If you want to give it a try, feel free to clone the package and open a PR fixing this. You can test your implementation by updating this test and running npm run test.

Cheers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants