I played a bit to see if this works with the router package like you suggested. This does work out of the box:
app.use(
router('/assets/:file',
serveFiles({
staticDir: `${process.cwd()}/assets`,
})
)
);
In this example, :file isn't used so it doesn't matter what the param is called.
However, the router package doesn't support wildcard matching. So I can request this:
/assets/app.css
but not this:
/assets/css/app.css
I think the unintuitive nature of having to define the route as /assets/:file' (as opposed to just /assets) and not being able to fetch nested assets makes documenting this compatibility not worth it.
Thoughts on adding wildcard matching to @curveball/router to support this package? The underlying package the router relies on is quite old and doesn't support wildcard matching. We'd have to find a new package or implement the route matching ourselves.
I played a bit to see if this works with the
routerpackage like you suggested. This does work out of the box:In this example,
:fileisn't used so it doesn't matter what the param is called.However, the router package doesn't support wildcard matching. So I can request this:
/assets/app.cssbut not this:
/assets/css/app.cssI think the unintuitive nature of having to define the route as
/assets/:file'(as opposed to just/assets) and not being able to fetch nested assets makes documenting this compatibility not worth it.Thoughts on adding wildcard matching to
@curveball/routerto support this package? The underlying package therouterrelies on is quite old and doesn't support wildcard matching. We'd have to find a new package or implement the route matching ourselves.