Initial commit: Anki flashcard creator web app
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>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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}`);
|
||||
});
|
||||
Reference in New Issue
Block a user