pmlopes/yoke

Static Middleware

Closed this issue · 2 comments

Should the Static Middleware be able to work from the Router or only from the yoke.use(Middleware)?

yoke.use(new Static("schema", 0, true, false));
will serve static files from the schema directory within the verticle resources

The following will only yield a 404
router.all("/schema", new Static( "schema" , 0, true, false));

yes it is a bug that i will investigate

There are a couple of issues here, when using the yoke.use the matching is done by prefix so anything that starts with / will be matched, when using the Router it needs to be a exact or regex match. So in this case all it can match is a request that is exactly /schema.

In this case it translates to:

Static midldeware root: schema/ (this is the first arg from the middleware) + the url request path /schema so in order to get anything else than 404 you need to have a file:

schema/schema

In your resources.