diff --git a/package.json b/package.json index df68068..52b777c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "queuenorth-website", "private": true, - "version": "0.6.2", + "version": "0.6.5", "type": "module", "scripts": { "dev": "concurrently \"vite\" \"node server/index.js\"", diff --git a/server/index.js b/server/index.js index af20216..52b9830 100644 --- a/server/index.js +++ b/server/index.js @@ -369,6 +369,7 @@ app.get('/api/health', (req, res) => { // Submit lead app.post('/api/leads', express.json({ limit: '1mb' }), (req, res) => { + let sanitized try { const parsed = leadSchema.safeParse(req.body) @@ -386,7 +387,7 @@ app.post('/api/leads', express.json({ limit: '1mb' }), (req, res) => { } // Sanitize parsed data before insert (trim, strip tags, truncate) - const sanitized = sanitizePayload(parsed.data, { + sanitized = sanitizePayload(parsed.data, { company: 200, name: 100, email: 254, @@ -488,28 +489,6 @@ app.post('/api/support', express.json({ limit: '1mb' }), (req, res) => { } }) -// --- 404 catch-all for API routes (must be after all API routes) --- -app.use((req, res, next) => { - if (req.path.startsWith('/api')) { - log.warn(`API route not found: ${req.method} ${req.originalUrl}`) - return res.status(404).json({ error: 'Not found' }) - } - next() -}) - -// Static file serving for SPA -app.use(express.static(path.join(__dirname, '../dist'))) - -// SPA catch-all — serve index.html for any non-API, non-asset route -// This lets React Router handle client-side routing -app.get('*', (req, res, next) => { - // Skip API routes (already handled above) and requests for static assets - if (req.path.startsWith('/api/') || req.path.includes('.')) { - return next() - } - res.sendFile(path.join(__dirname, '../dist/index.html')) -}) - // --- Request timeout middleware (30 seconds) --- const REQUEST_TIMEOUT_MS = 30000 @@ -547,6 +526,28 @@ const PORT = process.env.SERVER_PORT || 3001 // Register timeout middleware BEFORE catch-all routes app.use(timeoutMiddleware) +// --- 404 catch-all for API routes (must be after all API routes) --- +app.use((req, res, next) => { + if (req.path.startsWith('/api')) { + log.warn(`API route not found: ${req.method} ${req.originalUrl}`) + return res.status(404).json({ error: 'Not found' }) + } + next() +}) + +// Static file serving for SPA +app.use(express.static(path.join(__dirname, '../dist'))) + +// SPA catch-all — serve index.html for any non-API, non-asset route +// This lets React Router handle client-side routing +app.get('*', (req, res, next) => { + // Skip API routes (already handled above) and requests for static assets + if (req.path.startsWith('/api/') || req.path.includes('.')) { + return next() + } + res.sendFile(path.join(__dirname, '../dist/index.html')) +}) + app.listen(PORT, () => { log.info(`Server running on http://localhost:${PORT}`) log.info(`Health check: http://localhost:${PORT}/api/health`) diff --git a/src/components/layout/Footer.jsx b/src/components/layout/Footer.jsx index 6416ccf..0fec723 100644 --- a/src/components/layout/Footer.jsx +++ b/src/components/layout/Footer.jsx @@ -1,3 +1,5 @@ +import { Link } from 'react-router-dom' + const Footer = () => { const currentYear = new Date().getFullYear() @@ -58,12 +60,12 @@ const Footer = () => {
- Contact Form + Contact Form© {currentYear} Queue North Technologies. All rights reserved.
@@ -74,12 +76,12 @@ const Footer = () => {Schedule a free consultation with our communications experts to discuss your needs.
- Request Consultation - + diff --git a/src/pages/Contact.jsx b/src/pages/Contact.jsx index 6996202..07ad52e 100644 --- a/src/pages/Contact.jsx +++ b/src/pages/Contact.jsx @@ -5,6 +5,7 @@ import { Button } from '@/components/ui/Button' import { Input } from '@/components/ui/Input' import { Textarea } from '@/components/ui/Textarea' import { Select } from '@/components/ui/Select' +import { Link } from 'react-router-dom' import { api } from '@/lib/api' import { useDebounce } from '@/hooks/useDebounce' @@ -124,9 +125,9 @@ const Contact = () => { diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index 0fa9749..4f57852 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -354,7 +354,7 @@ const Home = () => {Industry-specific solutions designed to address your unique challenges and requirements.
-