改為依 db 參數切換 (use x_db)
This commit is contained in:
@@ -51,10 +51,16 @@ app.post(ormRoutes, async (req, res, next) => {
|
||||
try {
|
||||
const params = ormService.prepareOrmPayload(req);
|
||||
// 增加一個 log 觀察是哪個路徑進來的
|
||||
logger.info(`Incoming Request: ${req.url} -> SP: ${req.params.name}`);
|
||||
// logger.info(`Calling SP: ${req.params.name} by User: ${req.body.token || 'Guest'}`);
|
||||
// logger.info(`Incoming Request: ${req.url} -> SP: ${req.params.name}`);
|
||||
logger.info(`Incoming Request: ${req.url} -> DB: ${req.params.dbname} -> SP: ${req.params.name}`);
|
||||
|
||||
const result = await ormService.executeSp(
|
||||
req.params.name,
|
||||
params,
|
||||
req.params.dsNo,
|
||||
req.params.dbname
|
||||
);
|
||||
|
||||
const result = await ormService.executeSp(req.params.name, params, req.params.dsNo);
|
||||
res.json(result);
|
||||
} catch (err) {
|
||||
logger.error(`API Error on ${req.params.name}: ${err.message}`);
|
||||
@@ -73,6 +79,11 @@ app.post('/upload/:dbname/:typeid', upload.single('file'), (req, res) => {
|
||||
res.json({ status: 0, data: { value: fileUrl, url: fileUrl }, msg: 'success' });
|
||||
});
|
||||
|
||||
// 20260409 test IIS 反向代理
|
||||
app.get('/ping', (req, res) => {
|
||||
res.send('pong! IIS Reverse Proxy Success !!');
|
||||
});
|
||||
|
||||
// 全域錯誤處理
|
||||
app.use((err, req, res, next) => {
|
||||
res.status(err.status || 500).json({ status: err.status || 500, msg: err.message });
|
||||
|
||||
Reference in New Issue
Block a user