Skip to content

Commit

Permalink
better to commit the compiled code so there are no compilation errors…
Browse files Browse the repository at this point in the history
… after resetting the demo
  • Loading branch information
schottsfired committed Aug 21, 2024
1 parent 934fa65 commit c5510a3
Show file tree
Hide file tree
Showing 1,463 changed files with 216,060 additions and 0 deletions.
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.app = void 0;
const express_1 = __importDefault(require("express"));
const multer_1 = __importDefault(require("multer"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
exports.app = (0, express_1.default)();
const upload = (0, multer_1.default)({ dest: 'uploads/' });
exports.app.use(express_1.default.static('public'));
exports.app.post('/upload', upload.single('pdf'), (req, res) => {
if (!req.file) {
return res.status(400).send('No file uploaded.');
}
res.send(`File uploaded: ${req.file.filename}`);
});
exports.app.get('/download/:filename', (req, res) => {
const filePath = path_1.default.join(__dirname, 'uploads', req.params.filename);
const fileStream = fs_1.default.createReadStream(filePath);
fileStream.on('error', () => {
res.status(404).send('File not found');
});
fileStream.pipe(res);
});
exports.app.listen(3000, () => {
console.log('Server listening on port 3000');
});
1 change: 1 addition & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c5510a3

Please sign in to comment.