forked from snyk-partners/ai-generated-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better to commit the compiled code so there are no compilation errors…
… after resetting the demo
- Loading branch information
1 parent
934fa65
commit c5510a3
Showing
1,463 changed files
with
216,060 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.