0a4659f7e6
Converts Japanese vocab (Kanji/Hiragana/English) to Anki CSV format. Served on port 4002 with a dark-themed two-panel UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
720 B
JavaScript
31 lines
720 B
JavaScript
const http = require('http');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const PORT = 4002;
|
|
const ROOT = __dirname;
|
|
|
|
const mime = {
|
|
'.html': 'text/html',
|
|
'.css': 'text/css',
|
|
'.js': 'text/javascript',
|
|
};
|
|
|
|
http.createServer((req, res) => {
|
|
const urlPath = req.url === '/' ? '/index.html' : req.url;
|
|
const file = path.join(ROOT, urlPath);
|
|
|
|
fs.readFile(file, (err, data) => {
|
|
if (err) {
|
|
res.writeHead(404);
|
|
res.end('Not found');
|
|
return;
|
|
}
|
|
const ext = path.extname(file);
|
|
res.writeHead(200, { 'Content-Type': mime[ext] || 'text/plain' });
|
|
res.end(data);
|
|
});
|
|
}).listen(PORT, () => {
|
|
console.log(`Anki FC Creator running at http://localhost:${PORT}`);
|
|
});
|