image not displaying on my web page when hosted in lite -server local host..? - node.js

when opened the index.html file normally image is displaying
when hosted on lite server the image is not displaying
here is the html code and all the files directory
getting get request 404 for the image file.
here is the bs-config file for the lite-server
is there any solution please...!

I guess if you remove .. from img src, like /src/images/... — it should work.
Paths should be structured keeping the root of your live-server in mind.

Related

Serving Node.js files from a LXC Turnkey container -Apache configuration needed?

I hope that I will not waste everyone's time, nor embarrass myself, but please hear/read my problem. I am new to this, so please bear with me.
Someone at work wrote a crude code in Node.js and I can see the .html files by having localhost: 8080 as the URL in the browser, while having the VisualStudio starting the npm with npm start command. Am I explaining this clear enough?
The webpages are displayed and all, but now comes the hurdle.
How can i have those pages served from a a Linux server?
If by analogy, I put some.html page inside the /var/www/ in a Apache server, pointing to the server's IP/somepage.html i can visualise it, what needs to be set up on a similar Node.js server?
Where do I have to put those files, inside what directory and what configuration is needed?
I thought to create a small LXC container and have those files and services saved as a template, but first I need to set this up correctly. Can Apache serve those files, do I have to make another configuration first?
I have those files served from a Windows machine from local host, and put the same files in a /node ,/opt/ www directory in a Linux machine, but no dice.

Uploading images in meteor js bundle folder on linux server

I'm on Windows and develop meteor project. When i need to upload public media i put it in public folder. After compilation to production on vps server with ubuntu i have tar.gz file which extracting into bundle.
So there is no public folder in a bundle, and all preloaded media placing at web.browser and web.browser.legacy folders in this bundle with access urls like "www.example.com/image.jpg".
I tried upload images into these folders (web.browser and web.browser.legacy) but urls doesn't work with new files. The question is why? And how i can set urls for another folder on server out of bundle and make it public because of all files will be removed after rebundle ?
Meteor-Files package works ok with that. Problem was i couldn't find download urls for uploaded images, answers is here, thx for that.
Default url is "example.com/cdn/storage/Images/image-collection-id/orignal/image-collection-id.extension"

Express JS not serving few static files, throws 500 internal server error

When express server is started with SPA application index file and few other static files are loaded and some files throw 500 error
NodeJS server is running, and serving the static files from the correct folder. (This can be confirmed as it loads index.html and some other assets)
As seen from the network tab scripts.2d2e0c1a64a29c086e01.js, jspdf.min.js, favicon are loaded from the same static folder, but other js files are not loaded.
When error files are opened with full link (localhost:3000/main-es2015.b21fb6bfbdb8538cc020.js) these files are also loaded aswell.
The static folder contains the build files from angular 8.
Same issue when tried with nginx reverse proxy config.
Any help is much appreciated. Thank you
I found that the new URL wasn't allowed in the Content Security Policy list, once adding it everything works as expected. Thank you.
I had a similar error -- HTTP 500 when requesting an image from Express -- and corrected it by granting more permission to the static files. When the error was happening, the image file had permissions -rw-rw----. I used sudo chmod 666 public/static/*.jpg to change this to -rw-rw-rw-, and the problem was solved.

I am trying to deploy my portfolio using heroku but kept getting an application error with code h10

I am trying to deploy my portfolio using Heroku and the web only has an HTML file, a CSS file, and a simple javaScript file. screenshot of all my files are here
I pushed all of these files to Github and linked them to Heroku. Heroku deployed successfully but as I opened the URL, it gives me an application error with code H10. I googled a lot of fixes and tried adding a Procfile file but none seems to have worked. Can Anyone help me with this issue?
You need to know that heroku is not designed to post static websites. Nevertheless if you still would like to upload static website you need to organize your structure to somehow trick Heroku to see your files as an application.
Add composer.json root directory by adding {} inside, and index.php to the root directory,in index.php, add the following line: <?php include_once("home.html"); ?>, change your index.html to home.html. Push them to heroku, now it should work.

Website images don't load, but other static files do

I have a problem that confuses me since hours. I have a small website with a chat application on an express server. On localhost there is no problem at all. Images load normally, css and js files ok, everything perfect.
But as soon as I push the code online into IBM-Cloud (ex-bluemix), images give me a 404. The rest of the static files do get served though, and the application otherwise works normally.
The file structure looks like this:
--client
--resources
logo.png
--scripts
loginScreen.js
--stylesheets
stylesheet1.css
index.html
--server
app.js
The server starts in app.js and in the code I've put this before initializing the server:
expressApp.use(express.static(path.join(__dirname, "..", "client")));
I had some small problems with filename casing which I detected after building a docker container, but this is resolved and shouldn't be the problem. Any ideas?
The Simple Cloud Foundation Toolchain was registering my commits in github successfully and triggered the auto-build and deploy.
All code changes were pulled normally by the bluemix server. But the filename changes not. So for example the file called Logo.png was renamed to logo.png locally. This change was pushed normally into github. But logging into the bluemix server with ssh revealed that the filename there remained Logo.png.
I had to change the filenames manually by $ mv and now it works.

Resources