Skip to content

Commit 562a156

Browse files
authored
Update server.js
1 parent 2bc8e8f commit 562a156

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

server.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@ const path = require('path');
55
// Import routes from src/npm
66
const route1 = require('./src/npm/auth');
77
const route2 = require('./src/npm/verification');
8-
const { router } = require('./src/npm/saveDetails');
8+
const { router: saveDetailsRouter } = require('./src/npm/saveDetails');
9+
const { router: dataRouter } = require('./src/npm/data');
910

1011
const app = express();
1112

1213
// Middleware
13-
app.use(cors()); // Enable CORS for all routes
14-
app.use(express.json()); // Parse incoming JSON bodies
14+
app.use(cors());
15+
app.use(express.json());
1516

1617
// Use the imported routes
17-
app.use(route1); // Use auth routes
18-
app.use(route2); // Use verification routes
19-
app.use(router); // Use saveDetails routes
18+
app.use(route1); // Auth routes
19+
app.use(route2); // Verification routes
20+
app.use(saveDetailsRouter); // SaveDetails routes
21+
app.use(dataRouter); // Data routes
2022

21-
const router = '';
22-
const { router } = require('./src/npm/data');
23-
app.use(router);
24-
25-
// Serve static files from src/public
23+
// Serve static files
2624
app.use(express.static(path.join(__dirname, 'src', 'public')));
2725
app.use(express.static(path.join(__dirname, 'src', 'lib')));
2826

29-
// Start the server
27+
// Start server
3028
app.listen(3000, () => {
3129
console.log('Server Listening on port 3000!');
3230
});

0 commit comments

Comments
 (0)