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 1bf744d commit d42b809
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,9 @@ 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';
router.get("/hero-list", async (req, res) => {
const url = 'https://mobile-legends.fandom.com/wiki/List_of_heroes';
try {
const response = await axios.get(url);
const $ = cheerio.load(response.data);
Expand Down

0 comments on commit d42b809

Please sign in to comment.