Open AshwinTayson opened 6 years ago
You are using koa-static
wrong
Try it another way:
const Koa = require('koa');
const serve = require('koa-static');
const STATIC_PATH = 'public/images/preview/';
const app = new Koa();
app.use(serve(STATIC_PATH));
app.listen(3000);
$ curl -I http://localhost:3000/1.png
HTTP/1.1 200 OK
@hcz I have what you said, but I am also getting 404 for all my assets. The contents are being delivered though, just the status code is 400. This is what I have
app.use(koaStatic(public_path, {
hidden: true,
setHeaders (res) {
res.setHeader('content-type', 'text/plain')
},
}));
This library doesn't work with the examples given.
Something as simple as
And try to visit localhost:3000/1.png Not found. Please improve the documentation.