Hello guys (and girls) ^^
I'm using koa2, koa-router, koa-static (try..) and no koa-send... but nothing work and i need your help. :D
So in fact, my js files are not find... and i have this ...
So i have installed koa-static and did this:
app.use(serve(__dirname + '/public'));
But a problem like this was appear :
koa deprecated Support for generators will been removed in v3. See the documentation for examples of how to convert old middleware //github.com/koajs/koa/tree/v2.x#old-signature-middleware-v1x server.js:18:5
I don't remember what i've tried but nothing worked... After 3 hours i've decided to change for koa-send !
So i install the new package and i code this from the example...
app.use(async function(ctx){
await serve(ctx, ctx.path, { root: __dirname + '/public' });
});
and now i get ...
TypeError: Path must be a string. Received { request:
Thanks to stackoverflow to lock me with 2 links because of reputation.... so here the code of everything... http://pastebin.com/Gmvg5r9F
Someone have an idea please ? How can i make this functionnal ? I'm desperate... if you have the answer, please... ^_^
And happy new year everyone :p
EDIT : package.json if you need : "http:"//pastebin.com/cBg73WAF
EDIT²: Srsly, i've tried every package and nothing works... My project is actually blocked...
First of all you are getting
koa deprecated Support for generators will been removed in v3. See the documentation
because you are using akoa v2
with akoa v1
"compatible" middleware but you can easily go around this usingkoa-convert
to convert allgenerator
based middlewares to the newkoa v2
async/await standards and use it without a problem.Example of koa convert
Lastly, I think you are facing that second error because you are using
serve
instead ofsend
and that triggers thekoa-static
you just abandoned instead.