26 lines
704 B
JavaScript
26 lines
704 B
JavaScript
import dotenv from 'dotenv';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import express from 'express';
|
|
import cors from 'cors';
|
|
import discordRoutes from './routes/discord.js';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
dotenv.config({ path: path.resolve(__dirname, '../sandbox/.env') });
|
|
|
|
const app = express();
|
|
const PORT = process.env.AUTH_PORT || 3004;
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
|
|
app.use('/auth', discordRoutes);
|
|
|
|
app.get('/health', (req, res) => {
|
|
res.json({ status: 'ok', service: 'thw-auth', timestamp: new Date().toISOString() });
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`THW Auth service running on http://localhost:${PORT}`);
|
|
});
|