- /about: company story, differentiators, values, founder bio, industries, company details - /services: 6 service cards with pricing, assurance pack, process steps, tech stack - /pricing: pricing table, retainer tiers, training, payment terms, discounts, comparison, FAQ, inline quote form - QuoteForm component with service dropdown + project description textarea - POST /api/quote endpoint via Resend for quote requests - Nav updated: About Us, Services, Pricing now route to standalone pages - SEO: JSON-LD schemas, sitemap.xml, llms.txt updated - Founder photo added Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
3.3 KiB
JavaScript
95 lines
3.3 KiB
JavaScript
import express from 'express';
|
|
|
|
const app = express();
|
|
app.use(express.json());
|
|
|
|
app.post('/api/contact', async (req, res) => {
|
|
const { fullName, workEmail, companyName, jobTitle, automationNeed, phoneNumber } = req.body;
|
|
|
|
if (!fullName || !workEmail) {
|
|
return res.status(400).json({ error: 'Missing required fields' });
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('https://api.resend.com/emails', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Authorization': `Bearer ${process.env.RESEND_API_KEY}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
from: 'AImpress Website <noreply@ai-impress.com>',
|
|
to: ['hello@ai-impress.com'],
|
|
subject: `New lead: ${fullName} — ${companyName || 'N/A'}`,
|
|
html: `
|
|
<h2>New Contact Form Submission</h2>
|
|
<p><strong>Name:</strong> ${fullName}</p>
|
|
<p><strong>Email:</strong> ${workEmail}</p>
|
|
<p><strong>Company:</strong> ${companyName || 'N/A'}</p>
|
|
<p><strong>Job Title:</strong> ${jobTitle || 'N/A'}</p>
|
|
<p><strong>Automation Need:</strong> ${automationNeed || 'N/A'}</p>
|
|
<p><strong>Phone:</strong> ${phoneNumber || 'N/A'}</p>
|
|
`,
|
|
}),
|
|
});
|
|
|
|
if (!response.ok) {
|
|
const err = await response.text();
|
|
console.error('Resend error:', err);
|
|
return res.status(502).json({ error: 'Email delivery failed' });
|
|
}
|
|
|
|
res.json({ ok: true });
|
|
} catch (err) {
|
|
console.error('Email error:', err);
|
|
res.status(500).json({ error: 'Internal error' });
|
|
}
|
|
});
|
|
|
|
app.post('/api/quote', async (req, res) => {
|
|
const { fullName, workEmail, companyName, jobTitle, phoneNumber, service, projectDescription } = req.body;
|
|
|
|
if (!fullName || !workEmail || !service || !projectDescription) {
|
|
return res.status(400).json({ error: 'Missing required fields' });
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('https://api.resend.com/emails', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Authorization': `Bearer ${process.env.RESEND_API_KEY}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
from: 'AImpress Website <noreply@ai-impress.com>',
|
|
to: ['hello@ai-impress.com'],
|
|
subject: `Quote request: ${fullName} — ${service}`,
|
|
html: `
|
|
<h2>New Quote Request</h2>
|
|
<p><strong>Name:</strong> ${fullName}</p>
|
|
<p><strong>Email:</strong> ${workEmail}</p>
|
|
<p><strong>Company:</strong> ${companyName || 'N/A'}</p>
|
|
<p><strong>Job Title:</strong> ${jobTitle || 'N/A'}</p>
|
|
<p><strong>Phone:</strong> ${phoneNumber || 'N/A'}</p>
|
|
<hr>
|
|
<p><strong>Service:</strong> ${service}</p>
|
|
<p><strong>Project Description:</strong></p>
|
|
<p>${projectDescription.replace(/\n/g, '<br>')}</p>
|
|
`,
|
|
}),
|
|
});
|
|
|
|
if (!response.ok) {
|
|
const err = await response.text();
|
|
console.error('Resend error:', err);
|
|
return res.status(502).json({ error: 'Email delivery failed' });
|
|
}
|
|
|
|
res.json({ ok: true });
|
|
} catch (err) {
|
|
console.error('Email error:', err);
|
|
res.status(500).json({ error: 'Internal error' });
|
|
}
|
|
});
|
|
|
|
app.listen(3001, () => console.log('Email API listening on :3001'));
|