npm start 포트 확인 추가

This commit is contained in:
2026-04-10 15:53:31 +09:00
parent c1ead98f80
commit bf85bdd11b

View File

@@ -481,16 +481,31 @@ app.get('/callback', (req, res) => {
});
async function startServer() {
try {
await initJwks();
await initOidc();
app.listen(PORT, '0.0.0.0', () => {
const server = app.listen(PORT, '0.0.0.0', () => {
console.log(`\n================================================================`);
console.log(`[서버 기동] Headless 로그인 데모 서버가 실행 중입니다.`);
console.log(`- 접속 주소: http://172.16.9.208:${PORT}`);
console.log(`- 로컬 주소: http://localhost:${PORT}`);
console.log(`================================================================\n`);
});
server.on('error', (err) => {
if (err.code === 'EADDRINUSE') {
console.error(`\n[오류] ${PORT}번 포트가 이미 사용 중입니다. 다른 포트를 사용하거나 해당 프로세스를 종료해주세요.`);
} else {
console.error(`\n[오류] 서버 실행 중 에러 발생:`, err.message);
}
process.exit(1);
});
} catch (err) {
console.error('\n[오류] 서버 초기화 실패:', err.message);
process.exit(1);
}
}
startServer();