Meexa
Meexa
Explore posts from servers
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
{ filepath: filepath ?? '/' } seems to work. http://localhost:3000/api/folders//? Not sure how to get rid of the ? though
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
Hey, I've had some time to look into this and I have this endpoint now .get('/:filepath{.+}?', ...) Then I can execute this function like so
function getFolders(filepath?: string) {
return api.folders[':filepath{.+}?'].$get({ param: { filepath } })
}
function getFolders(filepath?: string) {
return api.folders[':filepath{.+}?'].$get({ param: { filepath } })
}
The problem I have now is since filepath is optional, the filepath can be undefined. What happens then is that This request is made http://localhost:3000/api/folders/undefined? If I do this { filepath: filepath ?? '' } then the request is http://localhost:3000/api/folders/? Both requests fail. What am I doing wrong?
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
Thanks 🙏
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
@Nico Is that the correct link? Where do I look for the example?
7 replies