hospital information done
This commit is contained in:
@ -1,9 +1,53 @@
|
||||
// import express from 'express';
|
||||
// import { Language } from '../langs/lang';
|
||||
|
||||
// export class RoutePublic {
|
||||
// static setup(app: express.Application) {
|
||||
|
||||
// app.use(Language.apply)
|
||||
// }
|
||||
// }
|
||||
|
||||
// import express from 'express';
|
||||
// import { Language } from '../langs/lang';
|
||||
|
||||
// export class RoutePublic {
|
||||
// static setup(app: express.Application) {
|
||||
|
||||
// app.use(Language.apply)
|
||||
// }
|
||||
// }
|
||||
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { Language } from '../langs/lang';
|
||||
|
||||
export class RoutePublic {
|
||||
static setup(app: express.Application) {
|
||||
app.use(Language.apply);
|
||||
|
||||
app.use(Language.apply)
|
||||
// ⚠️ TAMBAHKAN INI - Serve static files untuk uploads
|
||||
app.use('/uploads', express.static(path.join(__dirname, '../../uploads')));
|
||||
|
||||
// Atau dengan custom error handling (pilih salah satu):
|
||||
/*
|
||||
app.get('/uploads/*', (req, res) => {
|
||||
const filePath = path.join(__dirname, '../../', req.path);
|
||||
|
||||
if (fs.existsSync(filePath)) {
|
||||
res.set({
|
||||
'Cache-Control': 'public, max-age=86400',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
});
|
||||
res.sendFile(filePath);
|
||||
} else {
|
||||
res.status(404).json({
|
||||
success: false,
|
||||
message: 'File not found'
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user