Express provided a nifty helper for defining a static folder for binary assets, such as styles, images, fonts, etc.
Would be great to have a similar feature, unless this was explicitly left out in order for folks to derive their own.
Hi there! This is intentionally left out. All Express does is expose the serve-static dependency (source) — it's only included to maintain the legacy API.
You can already use serve-static with Polka, since it's only a middleware! There's an example, too!
Admittedly, the current usage is a little funky for Express users. A refactor is in the works right now that will change this & make it more familiar for Express veterans:
const serve = require('serve-static')('assets', { ... });
polka()
.use(serve)
.get('...', () => {})
Closing since I definitely don't want to include this in core. But, a lighter serve-static alternative may be on the agenda... I haven't committed one way or another yet 馃槅
Good deal, I like that approach, but a getting started guide for express users might be a cool documentation feature.
Yeah, definitely! If the timeline allows it, I want 1.0 to release with a full documentation website too to get people away from a mile-long README.
Most helpful comment
Yeah, definitely! If the timeline allows it, I want 1.0 to release with a full documentation website too to get people away from a mile-long README.