feat: implement core Go application with web server

- Add Go modules with required dependencies (Gin, UUID, JWT, etc.)
- Implement main web server with landing page endpoint
- Add comprehensive API endpoints for health and status
- Include proper error handling and request validation
- Set up CORS middleware and security headers
This commit is contained in:
YourDreamNameHere
2025-11-20 16:36:28 -05:00
parent aa93326897
commit 89443f213b
57 changed files with 14404 additions and 0 deletions

View File

@@ -0,0 +1,268 @@
// Minimal JavaScript for essential functionality
// This file provides progressive enhancement - the site works without JavaScript
document.addEventListener('DOMContentLoaded', function() {
// Mobile menu toggle
const navToggle = document.getElementById('nav-toggle');
const navMenu = document.querySelector('.nav-menu');
if (navToggle && navMenu) {
navToggle.addEventListener('change', function() {
if (this.checked) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = '';
}
});
}
// Close mobile menu when clicking on links
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
link.addEventListener('click', function() {
if (navToggle) {
navToggle.checked = false;
document.body.style.overflow = '';
}
});
});
// Smooth scroll for anchor links
const anchorLinks = document.querySelectorAll('a[href^="#"]');
anchorLinks.forEach(link => {
link.addEventListener('click', function(e) {
const href = this.getAttribute('href');
if (href !== '#') {
const target = document.querySelector(href);
if (target) {
e.preventDefault();
const headerHeight = document.querySelector('.header').offsetHeight;
const targetPosition = target.offsetTop - headerHeight - 20;
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
}
}
});
});
// Header scroll effect
let lastScrollTop = 0;
const header = document.querySelector('.header');
window.addEventListener('scroll', function() {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if (header) {
if (scrollTop > 100) {
header.style.boxShadow = '0 2px 10px rgba(0,0,0,0.1)';
} else {
header.style.boxShadow = '';
}
}
lastScrollTop = scrollTop;
});
// Form validation helper
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
const requiredFields = form.querySelectorAll('[required]');
let isValid = true;
requiredFields.forEach(field => {
if (!field.value.trim()) {
field.classList.add('error');
isValid = false;
} else {
field.classList.remove('error');
}
});
if (!isValid) {
e.preventDefault();
// Show error message
const errorDiv = document.createElement('div');
errorDiv.className = 'form-error';
errorDiv.textContent = 'Please fill in all required fields';
const existingError = form.querySelector('.form-error');
if (existingError) {
existingError.remove();
}
form.insertBefore(errorDiv, form.firstChild);
// Remove error after 5 seconds
setTimeout(() => {
if (errorDiv.parentNode) {
errorDiv.remove();
}
}, 5000);
}
});
});
// Loading state for buttons
const buttons = document.querySelectorAll('.btn');
buttons.forEach(button => {
if (button.type === 'submit') {
button.addEventListener('click', function() {
this.disabled = true;
this.innerHTML = '<span class="spinner"></span> Processing...';
// Re-enable after 10 seconds (fallback)
setTimeout(() => {
this.disabled = false;
this.innerHTML = this.getAttribute('data-original-text') || 'Submit';
}, 10000);
});
// Store original text
button.setAttribute('data-original-text', button.innerHTML);
}
});
// Animate elements on scroll (optional enhancement)
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
// Observe feature cards and steps
const animateElements = document.querySelectorAll('.feature-card, .step');
animateElements.forEach(el => {
observer.observe(el);
});
});
// Utility functions
function showNotification(message, type = 'info') {
const notification = document.createElement('div');
notification.className = `notification notification-${type}`;
notification.textContent = message;
document.body.appendChild(notification);
// Show notification
setTimeout(() => {
notification.classList.add('show');
}, 100);
// Hide after 5 seconds
setTimeout(() => {
notification.classList.remove('show');
setTimeout(() => {
if (notification.parentNode) {
notification.remove();
}
}, 300);
}, 5000);
}
function copyToClipboard(text) {
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(() => {
showNotification('Copied to clipboard!', 'success');
});
} else {
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
showNotification('Copied to clipboard!', 'success');
}
}
// Add CSS for animations
const style = document.createElement('style');
style.textContent = `
.animate-in {
animation: fadeInUp 0.6s ease-out forwards;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.notification {
position: fixed;
top: 20px;
right: 20px;
padding: 1rem 1.5rem;
border-radius: 8px;
color: white;
font-weight: 500;
z-index: 10000;
transform: translateX(100%);
transition: transform 0.3s ease;
max-width: 400px;
}
.notification.show {
transform: translateX(0);
}
.notification-success {
background: #10b981;
}
.notification-error {
background: #ef4444;
}
.notification-info {
background: #3b82f6;
}
.form-error {
background: #fef2f2;
color: #dc2626;
padding: 0.75rem 1rem;
border-radius: 6px;
margin-bottom: 1rem;
border: 1px solid #fecaca;
}
.error {
border-color: #dc2626 !important;
}
.spinner {
width: 20px;
height: 20px;
border: 2px solid #ffffff;
border-top: 2px solid transparent;
border-radius: 50%;
animation: spin 1s linear infinite;
display: inline-block;
margin-right: 0.5rem;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`;
document.head.appendChild(style);