From 99e1d44f7d703181831aa5e5b18a488e7a422c31 Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 25 Feb 2022 22:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpublic=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/public.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/back/public.ts b/back/public.ts index b4cef216..34b99aee 100644 --- a/back/public.ts +++ b/back/public.ts @@ -5,23 +5,20 @@ import config from './config'; const app = express(); -const run = async () => { - app.get('/api/public/panel/log', (req, res) => { - exec('pm2 logs panel --lines 500', (err, stdout, stderr) => { - if (err || stderr) { - return res.send({ code: 400, data: err || stderr }); - } - return res.send({ code: 200, data: stdout }); - }); +app.get('/api/public/panel/log', (req, res) => { + exec('pm2 logs panel --lines 500', (err, stdout, stderr) => { + if (err || stderr) { + return res.send({ code: 400, data: err || stderr }); + } + return res.send({ code: 200, data: stdout }); }); -}; +}); app .listen(config.publicPort, async () => { await require('./loaders/sentry').default({ expressApp: app }); await require('./loaders/db').default(); - await run(); Logger.info(` ################################################ 🛡️ Public listening on port: ${config.publicPort} 🛡️