Fix coin tracker data persistence issue
- Updated API URLs from localhost:3000 to localhost:3001 in script.js - Added CORS headers to server.js to enable cross-origin requests - Changed server port from 3000 to 3001 to avoid port conflicts - Updated CSP in index.html to allow connections to localhost:3001 - Coin tracker entries now persist across page refreshes
This commit is contained in:
@@ -5,12 +5,20 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const cron = require('node-cron');
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
const port = 3001;
|
||||
|
||||
// Serve static files from the current directory
|
||||
app.use(express.static(__dirname));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// Add CORS middleware
|
||||
app.use((req, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
|
||||
next();
|
||||
});
|
||||
|
||||
// Create backups directory if it doesn't exist
|
||||
const backupDir = path.join(__dirname, 'backups');
|
||||
if (!fs.existsSync(backupDir)) {
|
||||
|
||||
Reference in New Issue
Block a user