I'm using MulterJS for upload files from my Angular project with Express for Server Side.I had test on my development(Windows,Mac OS) on local and network.It can upload normally.but when I put my code on linux server it's can't upload any file in same code. I don't know how to fix this problem.
Initially I changed permission on destination folder to 777 so that It not work. Please Help ,Sorry for my Bad in English.
On any test PC or Server. I run this project in Server side npm start on port 3000
I solved by my self. I forgot to change API path and route to same with express on Client-Side. Thanks #HRK44
Related
When I run netlify dev it writes
⠴ Waiting for framework port 3000. This can be configured using the 'targetPort' property in the netlify.toml
And some times later it leaves the line
How to configure netlify, and how to launch the server on port 8888 instead of 3000
I created netlify.toml file in folder netlify/functions , but I think netlify doesn't see the netlify.toml file
I wait your help! Thanks in advance!
I never deployed any project before and I'm currently running with an issue while deploying a next.js app to godaddy. I uploaded my next.js app to the public_html folder of my cpanel and then i connected through ssh and executed the npm run dev command with server.js pointing to my domain name as hostname and 3000 as port number however, to access it i will have to write in the url www.mydomain.com:3000 . I learned that in order to access it by the following url www.mydomain.com I have to specify port 80 in the server.js file. However, when I do so and run the npm run dev command it says that I do not have the permission to port 0:0:0:0:80
Screenshot here
I have a VPS server and a domain name. I am doing something wrong or is there something I missed? Should I not use my domain name as hostname in the server.js file? Should I maybe keep the hostname as my VPS ip and port 3000 then point my domain to read from this address? I am a beginner with no previous exprience in deployement and this is my first next.js app ever.
Any help is appreciated and thank you!
I am trying to upload my site. it's a node.js repo on a linux instance on amazon light sail services.
I uploaded my source code repository to my Virtual Server Instance with static IP using FileZilla through a SSh pem key(all fine i guess..), also I modified the file for the apache server as mentioned in the walk-though tutorial but, I am not able to make it show when I write http://54.87.121.120/spanishwithalex/server/
Before I upload my repo I tried with a simple app that worked perfectly,but now i don't know why it doesn't work. I tried various ports, different locations and various forms but I think I am walking in circles.
I attached some pictures to show where I located my files and the error messages.
I hope it's some how clear.
Thanks
location in my instance
structure repo
error message
apache conf
I'm not great on apache config, but I walked through this enough to get you going:
SFTP or SCP your code to a new folder called /opt/bitnami/apache2/spanishwithalex
Edit /opt/bitnami/apache2/conf/bitnami/bitnami.conf using VIM or whatever and replace every line that has this /opt/bitnami/apache2/htdocs
with this: /opt/bitnami/apache2/spanishwithalex
Restart Apache:
sudo /opt/bitnami/ctlscript.sh restart apache
Let me know if that gets it working for you.
I have created a project using angular-universal.
after building the project it created browser, server, server.js and prerender.js. I want to know how it can run on the nginx.
with the current scenario i create the build of the project send it's zip file to the /var/www/html and unzip it there and it runs.
Make sure your angular ssr project is running on same port , which you domain is listning to in nginx configuration file.
By default it listnes to 80 port , you need to change that port number in nginx configuration file and restart the server.
So I'm trying to get chat working on my website, and when I was testing locally it worked great, because port 8080 on my localhost was available and all that good stuff. But now I pushed my code to my Heroku app, and when I try and load my chat page, I get the error stating that it can't get localhost:8080/socket.io/socket.io.js.
I've seen node.js /socket.io/socket.io.js not found
and tried the suggestions, but none worked, even moving the socket.io.js file into a resource file did not work. I'm guessing this is because I'm using express 4.0?
Any help would be appreciated
Thanks
Edit:
So to add more details, since my question could seem a little vague, here is my relevant app.js code:
var client = require('socket.io').listen(8080).sockets;
In my jade file for the chat page, I have:
script (src = `'http://localhost:8080/socket.io/socket.io.js`')
and later on
var socket = io.connect(`'http://localhost:8080`');
and all this works on localhost (I load up on port 5000, socket.io is connected to port 8080). I do this using 'foreman start' with the heroku toolbelt.
When I try and change these to work on heroku, it breaks and I'm not sure how to fix it. I hope this clarifies the question a bit.
Edit 2:
I'm running:
express 4.0.0
socket.io 0.9.16
node 0.10.x
Thanks
Do you have an explicit route in express which catches all other routes? Something like this perhaps:
app.get("/", handlers.home);
app.get("/..." ...);
...
app.get("*", handlers.error);
This might keep socket.io from being able to host it's own js file for the client. There is an easy way to fix this, since you probably already have a public or static folder setup in express. Something like:
app.use(express.static("public"));
Make a new folder called socket.io and copy over the appropriate socket.io.js file into said folder, and all should be well. However note that there are two files named socket.io.js!! So, if you see something like "Uncaught ReferenceError: require is not defined" it means you copied the "node-ey" server side file. Here is the correct client file to copy:
app_dir/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.min.js
Note #BHendricks: I would have just posted as a reply to your comment, but I currently lack the required reputation.
Edit:
The OPs question probably has more to do with the "localhost" issue. When connecting from a client (say your home IP), as far as your browser knows - localhost implies a connection with the machine which is locally hosting stuff. Since your home machine (or phone) does not host socket.io, this is failing.
What you need to do is have your server embed the socket connection information (either a fully qualified hostname, ip etc). This can be done when the server "renders" the page with the client connection.
What happens when you go to http://localhost:8080/socket.io/socket.io.js?
Does it 404? If it does you need to make sure you have it in a directory that Express is set to serve statically.
app.use(express.static(__dirname + '/public'));
Then put your socket.io.js file in public/socket.io/socket.io.js (relative to your app.js file)
Restart your server and see if that fixes it.
Basically, Express doesn't serve files statically from the file system unless you explicitly tell it where to map from.