-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (19 loc) · 715 Bytes
/
Copy pathserver.js
File metadata and controls
23 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Minimal Express server for local development
require('dotenv').config();
const express = require('express');
const serverless = require('serverless-http');
const api = require('./netlify/functions/api');
const path = require('path');
const app = express();
// Serve static files from public
app.use(express.static(path.join(__dirname, 'public')));
// Mount the API at root since api.js routes already have /api prefix
app.use('/', api.app || api);
// Fallback to index.html for SPA
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`EduCrate running at http://localhost:${PORT}`);
});