Image Transport Using Nodejs Request Module

Asked

Viewed 20 times

0

I have a code that makes a request for a site is delivery to the user But it can not send Images The Image Does Not Load(When I lower the image it shows q ta corrupted) When I enter the Site. Codigo:

const express = require('express');
const request = require('request');
var fs = require('fs')
const app = express();

String.prototype.replaceAll = function(a,b) {return this.split(a).join(b)}

//app.use('/myspace', express.static(__dirname+'/myspace'))
app.use(express.static(__dirname+"/windows94"))


app.get('/myspace/*', (req, res) => {
  request({uri: "http://myspace.windows93.net/" + req.originalUrl.split('/').slice(2).join('/')},function(er, rsp, body) {
    
    res.type(rsp.headers["content-type"]);
    res.send(body);
  console.log('A User Go To URL: ', req.originalUrl);
  });
});
app.listen(3000, () => {
  console.log('server started');
});
  • 1:Are you using cloudinary, aws or another server? 2: What are you using to upload? Insomnia? 3: put the way you are sending, you know that this GET is just to receive data right? 4: You want to use the front? if it’s for reactjs or React-Native, I recommend this link https://www.youtube.com/watch?v=Y4e3WEv5drE&t=577s. 5:Which database you use?

  • other server, request, html

  • try changing the protocol from http to https in the request language: "https://myspace.win....

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.