mirror of
https://github.com/gigirassy/plaster.git
synced 2024-12-23 18:39:07 +00:00
Update app.js
This commit is contained in:
parent
27d430d017
commit
0636b92669
14
app.js
14
app.js
@ -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}`);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user