You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
I'd love to be able to define dynamic routes such as api/blog/[slug].json.js which I can fetch or export as api/blog/the-title.json.
My use case is something like the following url structure.
/blog/[slug].html Serves html page
/blog/[slug].json.js Serves json version
/blog/[slug].md.js Serves markdown source
Also when exporting the current sapper-template app the api routes become files without the proper file extension and as such don't get served with the correct mime type by static file servers without extra effort. Or did I miss something?
Allowing multiple dynamic parts at one level might be cool, too. Such as /dynamic/route/[id]_[slug].js. Just a thought while we're updating the route pattern logic.
I tried to hack it together myself, but at the moment I am still figuring out the code base. Also RegExp...
The text was updated successfully, but these errors were encountered:
Excellent idea, thanks! Implemented in 0.7.5 (including the [id]_[slug].js bit).
Also when exporting the current sapper-template app the api routes become files without the proper file extension and as such don't get served with the correct mime type by static file servers without extra effort. Or did I miss something?
No, you didn't miss anything. It basically works by capturing requests and saving them; if the response is text/html then it will append /index.html because file servers will generally accommodate that, but otherwise it has to keep the path identical to what was requested, even if that means borking up the mime type.
With this change, it's more practical to use .json extensions, so we should do that and update our examples. I think I'm going to update the default template to use the /blog/some-post.json pattern, I prefer it to /api/blog/some-post.
I'd love to be able to define dynamic routes such as
api/blog/[slug].json.js
which I can fetch or export asapi/blog/the-title.json
.My use case is something like the following url structure.
/blog/[slug].html
Serves html page/blog/[slug].json.js
Serves json version/blog/[slug].md.js
Serves markdown sourceAlso when exporting the current
sapper-template
app the api routes become files without the proper file extension and as such don't get served with the correct mime type by static file servers without extra effort. Or did I miss something?Allowing multiple dynamic parts at one level might be cool, too. Such as
/dynamic/route/[id]_[slug].js
. Just a thought while we're updating the route pattern logic.I tried to hack it together myself, but at the moment I am still figuring out the code base. Also RegExp...
The text was updated successfully, but these errors were encountered: