fix: mount routes without /api prefix to support Traefik stripping
This commit is contained in:
+14
-2
@@ -24,6 +24,14 @@ app.use('/api/qr', qrRoutes);
|
||||
app.use('/api/analytics', analyticsRoutes);
|
||||
app.use('/api/admin', adminRoutes);
|
||||
app.use('/api/payments', paymentsRoutes);
|
||||
|
||||
// Support Traefik stripped prefixes
|
||||
app.use('/auth', authRoutes);
|
||||
app.use('/qr', qrRoutes);
|
||||
app.use('/analytics', analyticsRoutes);
|
||||
app.use('/admin', adminRoutes);
|
||||
app.use('/payments', paymentsRoutes);
|
||||
|
||||
app.use('/l', redirectRoutes);
|
||||
|
||||
// Postgres setup
|
||||
@@ -42,7 +50,7 @@ const redisClient = createClient({
|
||||
|
||||
redisClient.on('error', (err) => console.log('Redis Client Error', err));
|
||||
|
||||
app.get('/api/health', async (req, res) => {
|
||||
const healthCheck = async (req, res) => {
|
||||
let pgStatus = 'Unknown';
|
||||
let redisStatus = 'Unknown';
|
||||
|
||||
@@ -71,7 +79,11 @@ app.get('/api/health', async (req, res) => {
|
||||
redis: redisStatus
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
app.get('/api/health', healthCheck);
|
||||
app.get('/health', healthCheck);
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`CK-QR API listening on port ${port}`);
|
||||
|
||||
Reference in New Issue
Block a user