Skip to content

@curveball/router support #3

@mhum

Description

@mhum

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions