|
|
|
|
@ -1,20 +1,11 @@
|
|
|
|
|
const express = require('express'); |
|
|
|
|
const app = express(); |
|
|
|
|
const path = require('path'); |
|
|
|
|
const fs = require('fs'); |
|
|
|
|
|
|
|
|
|
const port = 8000 |
|
|
|
|
|
|
|
|
|
const videoFiles = [ |
|
|
|
|
{ "src": "assets/Blender Physics Simulations-8TGNRJDZX_o_compressed.webm"}, |
|
|
|
|
{ "src": "assets/Death Grips - Birds-XX5wk-6Mn5s_compressed.webm"}, |
|
|
|
|
{ "src": "assets/Jon Hopkins - 'Open Eye Signal' (Official Music Video)-Q04ILDXe3QE_compressed.webm"}, |
|
|
|
|
{ "src": "assets/Best Scene From Hackers The Movie-IyWv6snuZLk_compressed.webm"}, |
|
|
|
|
{ "src": "assets/$UICIDEBOY$ - O PANA!-VSXg2swBmrY_compressed.webm"}, |
|
|
|
|
{ "src": "assets/3D Fractals (Render Test 1)-xQ6nJYanKCY_compressed.webm"}, |
|
|
|
|
{ "src": "assets/Beyond The Minds Eye-wKxH51vPtHk -4_compressed.webm"}, |
|
|
|
|
{ "src": "assets/A Scene From Troll 2-HyophYBP_w4_compressed.webm"} |
|
|
|
|
// Add more video files as needed
|
|
|
|
|
]; |
|
|
|
|
const assetsDir = path.join(__dirname, 'assets'); |
|
|
|
|
|
|
|
|
|
app.use(express.static(path.join(__dirname))); |
|
|
|
|
|
|
|
|
|
@ -23,8 +14,19 @@ app.get('/', (req, res) => {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
app.get('/api/videos', (req, res) => { |
|
|
|
|
fs.readdir(assetsDir, (err, files) => { |
|
|
|
|
if (err) { |
|
|
|
|
console.error('Error reading directory:', err); |
|
|
|
|
res.status(500).send('Internal Server Error'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const webmFiles = files.filter(file => file.endsWith('.webm')); |
|
|
|
|
const videoFiles = webmFiles.map(file => ({ src: `assets/${file}` })); |
|
|
|
|
|
|
|
|
|
res.json(videoFiles); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
app.listen(port, () => { |
|
|
|
|
console.log('Server started on port', port); |
|
|
|
|
|