Update app.js

This commit is contained in:
nune 2024-12-18 16:47:33 -05:00 committed by GitHub
parent 27d430d017
commit 0636b92669
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

14
app.js
View File

@ -1,3 +1,12 @@
const express = require('express');
const fetch = require('node-fetch');
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.static('public'));
// Route to fetch Pastebin raw text data using the Paste ID
app.get('/fetch-paste', async (req, res) => {
const { url } = req.query;
if (!url) {
@ -22,3 +31,8 @@ app.get('/fetch-paste', async (req, res) => {
res.status(500).json({ error: error.message }); // Ensure error is JSON
}
});
// Start the server
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});