serve-test-form.js•919 B
const http = require('http');
const fs = require('fs');
const path = require('path');
const PORT = 5002; // Different port than SpiderFoot
const server = http.createServer((req, res) => {
// Serve the test form
if (req.url === '/') {
fs.readFile(path.join(__dirname, 'test-form.html'), (err, content) => {
if (err) {
res.writeHead(500);
res.end(`Error loading test form: ${err.message}`);
} else {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(content, 'utf-8');
}
});
} else {
// For any other URL, serve a 404
res.writeHead(404);
res.end('Not found');
}
});
server.listen(PORT, () => {
console.log(`Test form server running at http://localhost:${PORT}/`);
console.log(`Open this URL in your browser to test the form submission.`);
});