[object Object]

← back to Consulting Intake

chore: lint (intake write try/catch), v0.1.2 (session close)

6a3fbc6ee484940834bc73faae2423a067115fb9 · 2026-07-25 10:55:27 -0700 · Steve

Files touched

Diff

commit 6a3fbc6ee484940834bc73faae2423a067115fb9
Author: Steve <steve@designerwallcoverings.com>
Date:   Sat Jul 25 10:55:27 2026 -0700

    chore: lint (intake write try/catch), v0.1.2 (session close)
---
 package-lock.json |  4 ++--
 package.json      |  2 +-
 server.js         | 13 +++++++++----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index b95ea26..6640a18 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "consulting-intake",
-  "version": "0.1.1",
+  "version": "0.1.2",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "consulting-intake",
-      "version": "0.1.1",
+      "version": "0.1.2",
       "dependencies": {
         "dotenv": "^16.4.7",
         "express": "^4.21.2"
diff --git a/package.json b/package.json
index e8da4f0..aeb217c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "consulting-intake",
-  "version": "0.1.1",
+  "version": "0.1.2",
   "private": true,
   "description": "Consulting Intake — consulting portal (site concepts + integrated-social growth command center)",
   "main": "server.js",
diff --git a/server.js b/server.js
index 9a33d4e..3094438 100644
--- a/server.js
+++ b/server.js
@@ -77,10 +77,15 @@ app.get('/intake', (_req, res) => res.sendFile(path.join(PUB, 'intake.html')));
 app.get('/api/health', (_req, res) => res.json({ ok: true, client: 'Consulting Intake', at: new Date().toISOString() }));
 app.get('/api/client', (_req, res) => res.json(readJSON('client.json', {}))); // public-safe summary for signin page
 app.post('/api/intake', intakeGlobalLimit, intakeLimit, (req, res) => {
-  const all = readJSON('intakes.json', []);
-  all.push({ received_at: new Date().toISOString(), source: 'form', intake: req.body || {} });
-  writeJSON('intakes.json', all);
-  res.json({ ok: true, message: 'Thanks — your consulting intake was received.' });
+  try {
+    const all = readJSON('intakes.json', []);
+    all.push({ received_at: new Date().toISOString(), source: 'form', intake: req.body || {} });
+    writeJSON('intakes.json', all);
+    res.json({ ok: true, message: 'Thanks — your consulting intake was received.' });
+  } catch (e) {
+    console.error('intake write failed:', e.message); // don't leak the path/stack to the client
+    res.status(500).json({ ok: false, error: 'Could not save your submission — please try again.' });
+  }
 });
 
 // ---- gated routes ----------------------------------------------------------

← cdc7067 harden public /api/intake: per-IP + global rate limiting (no  ·  back to Consulting Intake  ·  (newest)