Refine and cleanup
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import notesRoutes from './routes/notes.routes.js';
|
||||
import router from './routes/notes.routes.js';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
app.use('/v1/notes', notesRoutes);
|
||||
app.use('/v1/notes', router);
|
||||
|
||||
app.use((req, res) => {
|
||||
res.status(404).json({ error: `Requested path is invalid or does not exist: ${req.method} ${req.originalUrl}` });
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
const config = {
|
||||
port: process.env.PORT || 3001,
|
||||
};
|
||||
|
||||
export default config;
|
||||
1292
backend/package-lock.json
generated
Normal file
1292
backend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ router.post('/cluster', async (req, res) => {
|
||||
const clusters = await clusterNotes(notes);
|
||||
res.json(clusters);
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: 'Clustering failed' });
|
||||
res.status(500).json({ error: `Clustering failed: ${err}` });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import app from './app.js';
|
||||
import config from './config/index.js';
|
||||
|
||||
const PORT = config.port || 3001;
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Backend running on port ${PORT}`);
|
||||
|
||||
Reference in New Issue
Block a user