Core: Route not found (404) for any files in public directory

Created on 30 Dec 2018  路  5Comments  路  Source: adonisjs/core

So I have (so far) 2 projects with AdonisJS (Thank you for this framework by the way, it may have been one of the best things I discovered this year), one is done, and the other is just started, but I use the first one to easily remember how I managed to solve a problem I would encounter.

I need to upload several files, and while I had no problem whatsoever with the first project, I can upload anything on the second one, it will get saved in the public directory... but I can't get to reach them, AdonisJS will return me the following:

HttpException
E_ROUTE_NOT_FOUND: Route not found GET /settings/landing.jpeg

All the files are CHMOD 755 and the the CHOWN is the same everywhere, even for the files, so I don't think it's a permission issue.

Package version

Adonis version 4.10
NPM version 6.5.0
Node version 10.13

Most helpful comment

Hey @Drillan767! 馃憢

Please, ensure that you have the StaticFileMiddleware enabled in your start/kernel.js file.

All 5 comments

Hey @Drillan767! 馃憢

Please, ensure that you have the StaticFileMiddleware enabled in your start/kernel.js file.

Thank you for your answer, that's weird because I didn't enabled it in my "old" project, yet I had no trouble reaching my files in the "public" directory.
What would the syntax to enable it in the kernel.js file?

Thank you in advance

My bad, I found the following line

'Adonis/Middleware/Static',

Being commented out, and I do remember uncommenting it on my old project, and now it works, thank you!

I ran into the same issues but none of the solutions above works

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

umaams picture umaams  路  3Comments

milosdakic picture milosdakic  路  3Comments

seanc picture seanc  路  4Comments

dezashibi picture dezashibi  路  4Comments

krunaldodiya picture krunaldodiya  路  3Comments