Skip to content

Commit

Permalink
Update routes.js
Browse files Browse the repository at this point in the history
  • Loading branch information
FrenzY8 authored Dec 19, 2024
1 parent 2d438a1 commit e2a771b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ const https = require("https");
const router = express.Router();
const cheerio = require('cheerio');

// ICON FETCHEF
app.get('/proxy-image', async (req, res) => {
const imageUrl = req.query.url; // Ambil URL gambar dari query parameter
try {
// Ambil gambar dari sumber eksternal
const response = await axios({
url: imageUrl,
responseType: 'stream', // Ambil sebagai stream untuk gambar
});

// Set header untuk merespons sebagai gambar
res.setHeader('Content-Type', response.headers['content-type']);
response.data.pipe(res); // Teruskan data stream gambar ke response
} catch (error) {
console.error('Error fetching image:', error);
res.status(500).send('Error fetching image');
}
});

// HEROES LIST + ICON
router.get("/heroes", async (req, res) => {
const url = 'https://liquipedia.net/mobilelegends/Portal:Heroes';
Expand Down

0 comments on commit e2a771b

Please sign in to comment.