Update index.js
Browse files317 unmodified lines31831932032132132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537624 unmodified lines4014024034024044054064075 unmodified lines4134144154144164174184197 unmodified lines4274284294284304314324337 unmodified lines4414424434424444454464475 unmodified lines4534544554544564574584595 unmodified lines4654664674664684694704717 unmodified lines4794804814804824834844858 unmodified lines4944954964954974984995006 unmodified lines507508509508510511317 unmodified lines };};
const app = express();const app = express() .set('json spaces', 4) .use(morgan('dev')) .use(express.json()); app.all('/', (req, res) => { const host = 'https://' + req.get('host'); res.json({ "List": [ { "title": "Tiktok Downloader", "method": "GET", "example": "${host}/tt?url=" }, { "title": "Facebook Downloader", "method": "GET", "example": "${host}/fb?url=" }, { "title": "Instagram Downloader", "method": "GET", "example": "${host}/ig?url=" }, { "title": "Youtube Downloader", "method": "GET", "example": "${host}/ytdl?url=" }, { "title": "Youtube Search", "method": "GET", "example": "${host}/ytsearch?q=" }, { "title": "Pinterest Downloader", "method": "GET", "example": "${host}/pindl?url=" }, { "title": "Mediafire Downloader", "method": "GET", "example": "${host}/mediafire?url=" }, { "title": "Mega Downloader", "method": "POST", "example": "${host}/mega", "body": "JSON.stringify({ \"url\": \"example.com\" })" } ]}),app.set('json spaces', 4);app.use(morgan('dev'));app.use(express.json());
app.all('/', (req, res) => { const host = 'https://' + req.get('host'); res.json({ "List": [ { "title": "Tiktok Downloader", "method": "GET", "example": `${host}/tt?url=` }, { "title": "Facebook Downloader", "method": "GET", "example": `${host}/fb?url=` }, { "title": "Instagram Downloader", "method": "GET", "example": `${host}/ig?url=` }, { "title": "Youtube Downloader", "method": "GET", "example": `${host}/ytdl?url=` }, { "title": "Youtube Search", "method": "GET", "example": `${host}/ytsearch?q=` }, { "title": "Pinterest Downloader", "method": "GET", "example": `${host}/pindl?url=` }, { "title": "Mediafire Downloader", "method": "GET", "example": `${host}/mediafire?url=` }, { "title": "Mega Downloader", "method": "POST", "example": `${host}/mega`, "body": "JSON.stringify({ \"url\": \"example.com\" })" } ] });}); app.get('/yt', async (req, res) => { const host = 'https://' + req.get('host'); try {24 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/ig', async (req,res) => { try { let {url} = req.query5 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/tt', async (req, res) => { try { let { url } = req.query7 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/pindl', async (req, res) => { try { let { url } = req.query7 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/fb', async (req, res) => { try { let {url} = req.query5 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/ytsearch', async (req, res) => { try { let q = req.query.q || req.query.query;5 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/mediafire', async (req, res) => { try { let { url } = req.query7 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.get('/ytdl', async (req, res) => { try { let { url } = req.query8 unmodified lines console.log(e); return res.json({ message: e.message }); } }), }); app.post('/mega', async (req, res) => { try { let { url } = req.body;6 unmodified lines console.log(e); return res.json({ message: e.message }); }}),}); app.listen(7860, () => console.log('App running on port 7860'));index.js+62-60