diff --git a/server.js b/server.js index 0875217..40689b3 100644 --- a/server.js +++ b/server.js @@ -30,6 +30,11 @@ app.get('/', (req, res) => { res.sendFile(path.join(__dirname, 'public', 'index.html')); }); +app.get('/download', (req, res) => { + const filePath = path.join(__dirname, 'test.txt'); + res.download(filePath); +}); + const io = new Server(server, { cors: { origin: '*', diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..7e7843f --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test file for download \ No newline at end of file