Comments (7)
Code / runnable example causing this? I already have some speculations and remember coming across and solving this when working myself, but I'd rather see the code and give you a direct answer.
from static.
@zhangda89 koa@2?
from static.
@zhangda89 You probably just need to use koa-convert
from static.
Here's an example, @zhangda89.
var Koa = require('koa')
var convert = require('koa-convert')
var statics = require('koa-static')
var app = new Koa()
app.use(convert(statics('./public')))
app.listen(3000)
from static.
ok, thanks, it works @tejasmanohar
from static.
@coderhaoxin Yes, it is koa@2
from static.
Yep, that's it. A lot of the official middleware has not been updated for Koa 2.x.x yet, as it's still in alpha. Many of them have open PRs (and more PRs are obviously appreciated). You will have to use koa-convert in order to convert koa 1.x.x middleware to be compatible w/ 2.x.x and this should work for most all things (but check the implementation yourself and ask questions if you have any :))
from static.
Related Issues (20)
- High severity security issue flagged by npm audit HOT 1
- Gzip has no effect. HOT 5
- Folders are not redirected if missing a slash at the end HOT 4
- possible vulnerabilities in koa-static
- please follow semver spec HOT 1
- when node version more than 10, it fails and alert some mistakes
- Add MIT License to root directory HOT 2
- start faild on node V11.12.0 HOT 1
- No support for Media Fragment URI HOT 1
- Migrate to @koa/static on NPM for consistency? HOT 1
- example not working HOT 1
- Static files not being served HOT 1
- Protected path with auth 🚧 -- Question HOT 1
- Should it have a folder view when it doesn't have an index.html? HOT 1
- Sending invalid gzip/br response HOT 1
- context.status is always 404 HOT 4
- Cannot serve .well-known (hidden) directory HOT 2
- David badge in README says "no longer available" HOT 1
- [feat] New Release HOT 4
- [feat] Disable caching for certain file types HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from static.