• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

154
Views
Get data back from server to front-end

Hi I'm building a video uploader and right now I can upload video from my front-end (React.js) to my back-end public folder (Node.js) using POST method (ajax). I was wondering how to now send it back to the front-end and get the videos to play. Thought of doing a GET method route of my back-end, could that work? (Have to say I'm a bit confused on this part since I'm only used to doing HTTP request from front to back...)

Would much appreciate any good advice to point me to the right direction. Thanks!

over 3 years ago · Santiago Trujillo
1 answers
Answer question

0

If you're saving the uploaded videos to a folder on your server, you could add something like this to your app:

app.get(__dirname + '/uploads/:vid', function(req, res){
res.sendFile(req.url);
});

Then you would simply send a regular GET request from your front-end to the path of the video (which will trigger the above function) and you should get the requested video in the response.

over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error