I have a ftp server in my network with my nodejs server.
The nodejs server hosts a website and i want users of that website to be able to download certain files of the ftp server.
How can this be done?
Related
Online examples will usually include the socket.io library using
<script src="/socket.io/socket.io.js"></script>
However, I was wondering why this works even though I don't have a socket.io folder in my directory. Does running node index.js automatically create this socket.io folder?
The socket.io server listens for all incoming requests that start with /socket.io and "steals" those requests for itself, keeping them from the regular http server that the socket.io server is sharing.
When the socket.io server sees that this is a request for the socket.io.js file, the socket.io server then reaches into its own node_modules/socket.io/client-dist directory to get the client-side socket.io.js file and sends it back to the client.
If you look at what you will find in node_modules/socket.io/client-dist directory, you will see the file socket.io.js sitting there. That's the file that the socket.io server sends back to the client. This is client-side code, only on the server for the purposes of being sent to the client when it asks for it.
Keep in mind that responses to incoming paths with a nodejs http server are not necessarily about file directories on the server at all. If any code hooked up to the http server handles an incoming request, it can decide what it wants to send as the response, from anywhere in the server (whether from a file or not). Only specific middleware tools like express.static() look on the server's hard disk for a directory that matches the incoming request.
I want to upload a file with resume capability to Cloudflare (tus enabled API). I cannot upload a file directly from the browser to Cloudflare because the credentials should not be visible. So, I have to use tus-node-server as an express middleware on the back-end.
I do not want to upload the file completely on my own server and after that start uploading the file to Cloudflare. Is there a way to pipe the tus-node-server middleware to Cloudflare upload API?
I received this answer from project's Github
I want to upload a file through multer which is locally, Now i want to set the destination a multer to the upload folder of a website which is hosted on the server like GoDaddy or aws etc
Don't mismatch your concept, localhost mean the ip of your system, so at server end it's a server ip which sense your api calls and handle that request. So multer is use to take your file and download it or copy file on your server, and the file is send from client side.
inshort client send it's file and server get that file process. the library which you are using is multer to handle file.
I use multer and save my pdf files to the upload folder on the heroku server but these files are deleted after some time so i want to save these files permanently to some other space. Can you help me by telling some free cloud service and how can i interact to the service with my node/express code.
I'm a little confused on how node.js works on web hosting servers.
Now i understand how it works when i download node.js on my computer, i run files and stuff and the node.js files are on my computer.
What i dont understand is how i run node.js on my web hosting server.
If node.js is a downloadable file, how do i get it to run on my server...
Do i just find the file on my computer that says node.js(or whatever its called) and upload that to my server?
Any clarification on how to run node.js on my server will help.
Thanks!
A server is just another computer somewhere running OS like Linux, Windows and others but at large scale. Now Node.js is automatically configured if your web hosting server is a shared server or free plan server like Heroku, an awesome web hosting company with great hosting plan.
You only get to install Node.js on a web hosting server if its a dedicated server like an Ubuntu Machine on Amazon or Digital Ocean. I don't think you should bother yourself much. If you want to move your Node.js app from localhost to a web server I encourage you to read heroku documentation or this scotch.io link. It is extremely simple.