/** * SSO Auth Service - 중앙 인증 서비스 * * TK Factory Services의 통합 인증을 담당 * - JWT 발급/검증/갱신 * - 사용자 CRUD * - bcrypt + pbkdf2 비밀번호 호환 */ const express = require('express'); const cors = require('cors'); const authRoutes = require('./routes/authRoutes'); const app = express(); const PORT = process.env.PORT || 3000; app.use(cors({ origin: true, credentials: true })); app.use(express.json()); // Health check app.get('/health', (req, res) => { res.json({ status: 'ok', service: 'sso-auth', timestamp: new Date().toISOString() }); }); // Auth routes app.use('/api/auth', authRoutes); // 404 app.use((req, res) => { res.status(404).json({ success: false, error: 'Not Found' }); }); // Error handler app.use((err, req, res, next) => { console.error('SSO Auth Error:', err.message); res.status(err.status || 500).json({ success: false, error: err.message || 'Internal Server Error' }); }); app.listen(PORT, () => { console.log(`SSO Auth Service running on port ${PORT}`); }); module.exports = app;