// Serves the fixture feeds so the daemon under test has something real to scan. const http = require('http'); const fs = require('fs'); const path = require('path'); const dir = __dirname; const port = Number(process.env.FIXTURE_PORT || 8792); http.createServer((req, res) => { const name = decodeURIComponent(req.url.split('?')[0].replace(/^\//, '')) || 'index'; const file = path.join(dir, path.basename(name)); fs.readFile(file, (err, body) => { if (err) { res.writeHead(404).end('no'); return; } const type = file.endsWith('.mp3') ? 'audio/mpeg' : file.endsWith('.opml') ? 'text/x-opml' : 'application/xml'; res.writeHead(200, { 'content-type': type, 'content-length': body.length }); res.end(body); }); }).listen(port, '127.0.0.1', () => console.log(`fixtures on ${port}`));