Single Express server that serves both the API and static frontend.
- Install deps:
npm install- Create
.envfrom.env.exampleand fill in real keys. Minimal example:
GEMINI_API_KEY=your_gemini_key
GOOGLE_API_KEY=your_google_maps_key
FBI_API_KEY=your_data_gov_key
PORT=3000
CACHE_TTL_SECONDS=900- Start server:
npm run startOpen: http://localhost:3000/
(Use npm run dev for auto-reload.)
- Frontend now calls the API at relative path
/api/getPropertyDetails. - Static files (
index.html,app.js,style.css) are served by Express. - In-memory cache + rate limiting included.
- Crime data: server tries city-level (agency ORI) then falls back to state-level FBI estimates.
- Crime API uses only
FBI_API_KEY. - Test your crime API key at
/test-fbi.html(runs multiple auth variants, shows which succeeded).