About the caching of these files in koa-static-cache

I didn"t load the koa-static-cache middleware, so the rendered image won"t come out. May I ask why there is a static resource server? if not, there is a problem with the picture path

there is also the following picture. Why does this file cache have to be written in two directories? it is not enough to write one alone. The file path is an images folder under the public folder

Mar.03,2022

https://www.npmjs.com/package.
if you want to access a picture, you should use koa-static instead of koa-static-cache,.

create a new public/images under the project root

const static = require('koa-static');    //
const  staticPath = './public';  // 
app.use(static(
    path.join( __dirname, staticPath)
));

so that you access the picture public/images/1.jpg is like this localhost:8080/images/1.jpg


Please see what is written at the beginning of the official README.md.

Static server for koa.

Differences between this library and other libraries such as static:

* There is no directory or index.html support.
* You may optionally store the data in memory - it streams by default.
* Caches the assets on initialization - you need to restart the process to update the assets.(can turn off with options.preload = false)
* Uses MD5 hash sum as an ETag.
* Uses .gz files if present on disk, like nginx gzip_static module

therefore, you should obviously use koa-static instead of koa-static-cache here.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3ca24-42c7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3ca24-42c7e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?