-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
45 lines (38 loc) Β· 1.33 KB
/
server.js
File metadata and controls
45 lines (38 loc) Β· 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const express = require('express');
const path = require('path');
const cors = require('cors');
const app = express();
const PORT = process.env.PORT || 3000;
// Enable CORS for all origins (needed for Auth0)
app.use(cors({
origin: true,
credentials: true
}));
// Serve static files from current directory
app.use(express.static(path.join(__dirname)));
// Handle routing for single page application
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
// Handle auth callback route
app.get('/callback', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
// Test auth route
app.get('/test-auth', (req, res) => {
res.sendFile(path.join(__dirname, 'test-auth.html'));
});
app.listen(PORT, () => {
console.log('π Astral 3D Server is running!');
console.log(`π‘ Local: http://localhost:${PORT}`);
console.log(`π Network: http://127.0.0.1:${PORT}`);
console.log('');
console.log('β
Auth0 Callback URLs to add in dashboard:');
console.log(` http://localhost:${PORT}`);
console.log(` http://localhost:${PORT}/callback`);
console.log(` http://127.0.0.1:${PORT}`);
console.log(` http://127.0.0.1:${PORT}/callback`);
console.log('');
console.log('π§ Test Auth0: http://localhost:' + PORT + '/test-auth');
console.log('π Main Site: http://localhost:' + PORT);
});