koajs / examples

Example Koa apps
4.52k stars 744 forks source link

Example of implementing static file service with caching! #100

Closed DoumanAsh closed 7 years ago

DoumanAsh commented 7 years ago

While it is always nice to use already made middlewares, it might be interesting to take a look how simple is to implement static file service with caching.

I made it sometime ago for one project and want to include it as example. What do you think about this idea?

Note that it was made for koa2 so i copy-pasted code as it is. If you're ok with this example, i can adapt it to koa1.

bananaappletw commented 7 years ago

@DoumanAsh Current repo is migrating from koa1 to koa2, I init the repo for koa2 in this pull request https://github.com/koajs/examples/pull/99. Waiting for review. For koa1, you could send the pull request to koa-v1 branch.

haoxins commented 7 years ago

@DoumanAsh

https://github.com/koajs/static-cache is for this :)

DoumanAsh commented 7 years ago

Oh... ok. I actually forgot about this PR :D