update api chapterlesson
This commit is contained in:
parent
2fc0fb7a76
commit
5c2b5d55aa
11 changed files with 855 additions and 85 deletions
37
Backend/scripts/post-tsoa.js
Normal file
37
Backend/scripts/post-tsoa.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Post-TSOA Generation Script
|
||||
* Fixes the multer file size limit in generated routes.ts
|
||||
*
|
||||
* Run after tsoa:gen to update file size limits
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const ROUTES_FILE = path.join(__dirname, '../src/routes/routes.ts');
|
||||
const OLD_LIMIT = '"fileSize":8388608'; // 8MB (tsoa default)
|
||||
const NEW_LIMIT = '"fileSize":1073741824'; // 1GB
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(ROUTES_FILE)) {
|
||||
console.error('Error: routes.ts not found at', ROUTES_FILE);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let content = fs.readFileSync(ROUTES_FILE, 'utf8');
|
||||
|
||||
if (content.includes(OLD_LIMIT)) {
|
||||
content = content.replace(OLD_LIMIT, NEW_LIMIT);
|
||||
fs.writeFileSync(ROUTES_FILE, content, 'utf8');
|
||||
console.log('✅ Updated multer file size limit to 1GB in routes.ts');
|
||||
} else if (content.includes(NEW_LIMIT)) {
|
||||
console.log('✅ Multer file size limit already set to 1GB');
|
||||
} else {
|
||||
console.warn('⚠️ Could not find multer fileSize config in routes.ts');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error updating routes.ts:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue