Socket.io client .js file not loading - javascript

I'm trying to deploy a socket.io chat in Heroku. The page loads, but the socket.io js file for the client is not getting downloaded, so the chat doesn't work.
Here's images of the console in browser showing the error, the javascript portion of the page itself, and the config code of the server, in that order.
https://imgur.com/a/4YeZh
Am I doing something wrong? Thank you in advance

I think there is, a problem in referencing socket.io file, beacuse all of your js files, are references from js directory, but socket.io file is directly referenced.

Related

WebGazer.js unexpected end of input

So I'm trying to play around with WebGazer but I'm already stuck at loading the js file. The webgazer.js file consists of 140k line of codes, but when I load my page the js file only loads until line 94k.
I don't want to use NPM cause it's causing me a lot of hassle to install & run the NPM. How do I fix this problem? Thanks in advance
It seems like when I save the webgazer.js in my project it is not uploaded fully to the server. I had to upload multiple times (3x) in order to fully upload the webgazer.js
I was using PhpStorm and ec2 instance (AWS) for my development server

Where should I put the frontend server code in app created with create-react-app?

I created an app with create-react-app and I'd like to log something in its server console. How could I do this?
I've tried adding index.js to the root folder and creating server folder, but it doesn't work.
Edit: I don't mean the backend server here, but just the frontend server. I'd like to print something in the same console where I type npm start. Is it possible?
If I understand correctly to do such a thing you should do eject your create-react-app otherwise you won't be able to modify the build scripts.
After the eject you can modify the webpack script or any other script you need to.
If you decide to do it, be careful because it will be more difficult to update your build dependencies.
First, you cannot put your backend code in the frontend code. Because the backend code is run by Node.JS enabled server. But the front end code is run by your browser.
All the react code will be bundled into one js file, which will be loaded by the browser. It will be simple JS files that renders views.
When you see localhost:3000 the server is given to you by default to VIEW and LOAD your front-end code. Most of the times it is webpack-dev-server.
The common options are:
1) If backend is REST/SOAP api then use XHR/ajax to hit the api. You just have to put the react generated JS file to your backend server's public folder. Also you can use completely different repos/codebases too in this approach.
2) You can use Server side rendering of sort where you put front end code in your backend views.

Is there any way to load js scripts in XAMPP with the same folder structure as in a regular server?

I have XAMPP and a separate cloud server. Inside XAMPP's htdocs there is a folder with a repository that I use to both develop, and push to the cloud server.
When using the same folder structure as the server ie. a script / js folder holding all the js files in the root of the folder (public_html/scripts) the server works fine.
The problem comes in development, where trying to access the scripts using src = "script/scriptname.js" gives me the error saying "Failed to load 404". Now I know it's just trying to search in localhost/scripts or htdocs/scripts rather than htdocs/projectname/scripts. I don't really want to have to move the script folder in and out all the time, as that's really tedious.
Is there any way to use a script folder without having to move it around in Xampp?

CSS or Javascript is not showing up on apache web server

So I am importing all of my website files onto my server and it is displaying the index.html as plain text and some basic images but no CSS or no JavaScript. I am running linux command line on putty connecting to my web server and I have no clue how to fix this, I have played and changed all permissions on the files also.
You have errors on your page for your JS and CSS file paths. Track down this issue.

Can i run a php file or a html file in a node js web server?

Maybe it's a stupid question but i am a newbie using node js, and I think that it can be used just with js files, I dont know, I installed node js on my windows and i started the web server but i dont know how to run the files, I have always worked with apache, I saw there is a folder called scrips in the node js installation folder
but i dont know how to run the files, I have always worked with apache.
In NodeJS, it's either you write the web server (it's like writing Apache itself), or use a framework that does it for you (it's like adding in something like Apache). Suggesting you check out Express. It's something almost close to CodeIgniter (writing points of entry).
Can i run a php file or a html file in a node js web server?
NodeJS is for JS. Your server files are all in JS. As for HTML, checkout Express (mentioned above), or if you just want to serve plain HTML (or static files), you may want to check out Connect Static

Categories