fixed routing issue
This commit is contained in:
parent
513305a5ab
commit
b36feabc98
@ -56,12 +56,6 @@ if (!fs.existsSync('./media')) {
|
|||||||
|
|
||||||
initDb().then(() => {
|
initDb().then(() => {
|
||||||
|
|
||||||
app.use('/api/auth', authRoutes);
|
|
||||||
app.use('/api/articles', articleRoutes);
|
|
||||||
app.use('/api/admin', adminRoutes);
|
|
||||||
app.use('/api/categories', categoryRoutes);
|
|
||||||
app.use('/api/tags', tagRoutes);
|
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.json({ message: 'Server is running' });
|
res.json({ message: 'Server is running' });
|
||||||
});
|
});
|
||||||
@ -676,11 +670,11 @@ initDb().then(() => {
|
|||||||
app.use('/media', express.static(path.join(__dirname, 'media')));
|
app.use('/media', express.static(path.join(__dirname, 'media')));
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, 'frontend/dist', 'index.html'));
|
res.sendFile(path.join(__dirname, 'frontend/dist', 'index.html'));
|
||||||
|
});
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server listening on ${PORT}`);
|
console.log(`Server listening on ${PORT}`);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('Failed to initialize database:', err);
|
console.error('Failed to initialize database:', err);
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user