This is a Node.js, Express, and MongoDB backend for managing leads.
- Node.js installed
- MongoDB installed and running locally (or you can use a MongoDB Atlas URI)
- Open a terminal in the
leaddirectory. - Run
npm installto install dependencies. - Update the
.envfile with your actualMONGO_URIif necessary.
Run the server with nodemon (auto-restarts on changes):
npm run devRun the standard Node server:
npm startThe server will run on http://localhost:5000 by default.
POST /api/leads- Create a new lead.- Required fields:
name,email - Optional fields:
company - Body example:
{ "name": "John Doe", "email": "john@example.com", "company": "Example Inc" }
- Required fields:
GET /api/leads- Get all leads.DELETE /api/leads/:id- Delete a lead by ID.
The backend is configured with CORS enabled, so it's ready to be connected to your frontend application.
Lovable Frontend Link: https://lovable.dev/projects/4d1568e1-84f9-4f05-9baf-f012efb457bb
Ensure that your frontend makes its API requests to the URL where this server is running (e.g., http://localhost:5000/api/leads).