asked    Denise     2018-10-22       html       91 view        2 Answers

[SOLVED] 404 (Not Found) Image file on web app

I am building a website and along the way I used imgur to store the image that i was using in it but I decided to created a folder in my app to store them. Since I'm not using imgur anymore, i needed to change my path to find the image and that's where the problem appeared, I can't find the image. The structure looks like that:


In main.js, I use one of the image in image_folder and the path to the image looks like: src="" but that's where I got the 404 error. I've tried putting the image in the same folder that the main.js so the path would look like src="" but still getting this error. So i guess it's not a path's problem but I've no idea what it could be.

Hope I could make it clear! I'm using node.js and express.

  2 Answers  

        answered    Venus     2018-10-22      

You need to make routes to the assets.


Whenever you are using an asset there are multiple ways to include that in your project.

In your case, whenever an image is loaded it is actually loaded by the browser using network calls from client side. Not server side. So client side code doesn't have access to internal paths (for ex: /usr/local/ kinda paths). Whenever they fetch something it is relative to the host, maybe in your case localhost so, fetching / is fetching localhost/ but your app doesn't have route to those image files. So, we make routes for all the assets which is done by express.static

Another way is you can actually require the image. So, bundlers (with proper config) make some public folder and put the assets to that folder. react/vue apps by default do this.

        answered    Barnett     2018-10-22      

As the comment said, I just need to add this line to the app.js:


Your Answer

 2018-10-22         Agnes

Is there a reason not to use parametised routes in the Play Framework

At work I am making some changes to an existing web app built using the Play Framework, and have noticed that none of the routes use parameters. On previous projects I've worked on I would expect to see routes like:GET /some-path/:id @controllers.BaseController.somePath(id: Int)Instead all the routes would be like so:GET /some-path @controllers.BaseController.somePath()In this case the web app uses a session manager to store and retrieve values, nothing is sent via parameters in the routes. I haven't seen this pattern before and don't have easy access to any...
 web-applications                     1 answers                     68 view
 2018-10-22         Barret

unable to install flask-mysqldb

I cant install flask-mysqldb _mysql.c:37:20: fatal error: Python.h: No such file or directorycompilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1i can't resolve You can try to install the python-dev package corresponding to your python version :sudo apt-get install python2.7-dev [XXX]
 python                     1 answers                     68 view
 2018-10-22         Jean

Visual studio won't debug into referenced DLL (from same solution)

I have a Visual studio 2008 solution, with 2 projects. A DLL, A, and a Web application, B. B has a project reference to A, and A.dll and A.pdb are being copied to B's bin/ directory.Everything is set to compile in debug mode.I can run the cassini webserver and debug web application B fine, but when I come to call a method in A.dll, pressing F11 to step into it does not step into it, it steps over it. I want to step into it.Any ideas why I might not be able to step into the source code of A?Edit: Additional InfoI do not have 'just my code' checked.I can set a breakpoint in t...
 visual-studio                     5 answers                     70 view