server.get(/\/docs\/current\/?.*/, restify.serveStatic({
directory: './documentation/v1',
default: 'index.html'
}));
As per the documentation, it will serve _./documentation/v1/docs/current/index.html_.
But it should serve _./documentation/v1/index.html_ right?
Thus, if I have a static folder, in which I have coverage.html, then if I use the code
server.get(/\/public\/?.*/, restify.serveStatic({
directory: './static',
default: 'index.html'
}));
And if I call the route _/public/coverage.html_, then it will serve the _./static/coverage.html_.
Thanks,
Raghu
I have thought the same reading the documentation.
:-1: Documentation sux
Weird behaviour
@RaghavendhraK "But it should serve ./documentation/v1/index.html right?"
Why.. ? Initially I was thinking the same thing too, i.e. the route /\/docs\/current\/?.*/ _should_ describe an abstract virtual action (having used ASP.NET MVC routing). But that's just not the way restify works, and once you learn how it works (as described in the docs), then it should be no more confusing.
Also it is more flexible the way it is.. the route is a RegEx so, for example, server.get(/\/test.*/.*/, restify.serveStatic({ can handle any url localhost:8080:test/, localhost:8080:testis/, localhost:8080:testicles/, localhost:8080:test/somePage.html, localhost:8080:testicles/anotherPage.html, and provided the files exist on disk, they will be served.
@marcellodesales "documentation sux"
Why? it's describing exactly what restify does, not what you think it should do.
This appears to be a duplicte of #535
Closing for now. Please let me know if I'm missing a nuance and we can re-open and discuss :heart:
Most helpful comment
:-1: Documentation sux