Blessing Jerusalem
const express = require('express');
const cors = require('cors');
const fetch = require('node-fetch');
const app = express();
app.use(cors());
app.use(express.json());
// Replace with your actual Google Apps Script Web App endpoint:
const GOOGLE_APPS_SCRIPT_URL = 'https://script.google.com/macros/s/AKfycbzbQtQmYlk6NE2eG_NGzaHWIvx3hnUlU5-8PyL_pXxLymrfauK8VbuVB63DQQ2EI26EwBA/exec';
app.post('/submit-blessing', async (req, res) => {
try {
const payload = req.body;
const response = await fetch(GOOGLE_APPS_SCRIPT_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
const result = await response.json();
res.status(200).json(result);
} catch (error) {
console.error('Proxy Error:', error);
res.status(500).json({ status: 'error', message: 'Proxy server failed to send data.' });
}
});
// Listen only if running locally
if (require.main === module) {
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
}
module.exports = app;