Refactor webhook URL configuration to use environment variable

- Updated questionnaire.js to use a local API endpoint as a fallback for the webhook URL.
- Modified server.js to retrieve the webhook URL from an environment variable.
- Added .env.example file to provide a template for environment configuration, including the optional webhook URL.
- Added an empty responses.json for local storage
This commit is contained in:
2025-09-07 22:04:51 +03:00
parent f4f5c54596
commit d0b14ba664
6 changed files with 495 additions and 169 deletions

View File

@@ -1,6 +1,8 @@
// This file handles the logic for the questionnaire, including collecting additional participant information after the quiz.
const WEBHOOK_URL = "https://n8n.olehomelchenko.com/webhook/kse-research";
// Configure webhook URL via environment variable on server side
// Fallback to local API endpoint if no external webhook configured
const WEBHOOK_URL = '/api/responses';
document.addEventListener('DOMContentLoaded', function() {
const questionnaireForm = document.getElementById('questionnaire-form');