Closed array-in-a-matrix closed 10 months ago
Please use this way instead
# declare path params
pathParams:
paramName int: # assign param name with `int` type
optional # param is optional
mutable # param is mutable variable
default = 100 # default param value is 100
I'll fix this in docs
Not sure if I should open a new issue as this is somewhat related.
import happyx
# declare path params
pathParams:
paramName int: # assign param name
optional # param is optional
mutable # param is mutable variable
default = 100 # default param value is 100
appRoutes "app":
"/":
"hello"
"/<paramName>":
{paramName}
The path /
works and returns hello
as expected but trying /24
or any other value does not work. The browser just loads infinitely. Am I doing something incorrect or is this a bug?
How you launch it?
Just nim js src.nim
or hpx dev
?
Started with hpx dev
Oh! You are suppose to keep the #/
. I was trying 127.0.0.1:5000/35
instead of 127.0.0.1:5000/#/35
.
Thank you for your help! Awesome project!
@Ethosa , quick question: why #/
is needed? can it be removed?
@veksha #/
needed only in SPA
@Ethosa i see it in SPA, i just don't know why it is there. maybe we can remove it somehow?
@veksha I think that it can be removed with History API
, but why?
@Ethosa It leads to confusion and makes links longer than necessary.
@veksha @array-in-a-matrix Ok, in next commit this possible
Small note: this will possible only with -d:historyApi
Wow a quick change! Thank you!
Describe the bug 🐛 The SPA example using routes does not build.
Error:
To Reproduce 👨🔬
hpx create --kind=SPA --name=app
(with or without tailwindcss)main.nim
with the SPA example from the documentation:declare path params
pathParams: paramName: # assign param name type int # param type optional # param is optional mutable # param is mutable variable default = 100 # default param value is 100
appRoutes "app":
Use paramName
"/":
echo paramName