Skip to content

coderpurohit/lead-backend

Repository files navigation

Lead Management Backend

This is a Node.js, Express, and MongoDB backend for managing leads.

Prerequisites

  • Node.js installed
  • MongoDB installed and running locally (or you can use a MongoDB Atlas URI)

Project Initialization

  1. Open a terminal in the lead directory.
  2. Run npm install to install dependencies.
  3. Update the .env file with your actual MONGO_URI if necessary.

Running the Application

Development mode

Run the server with nodemon (auto-restarts on changes):

npm run dev

Production mode

Run the standard Node server:

npm start

The server will run on http://localhost:5000 by default.

API Endpoints

  • 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" }
  • GET /api/leads - Get all leads.
  • DELETE /api/leads/:id - Delete a lead by ID.

Frontend Connection

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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors