Note : I am using Render.com for deployment and I am using the free tier. So it gets spindown with inactivity,
which can delay requests by 50 seconds or more.So please wait for 50 seconds for getting to initial request
and then it will work fine. Sorry for this issue.
NOTE: You can use the /api-docs to try the api -> Link to Api Documentation
This project is a web service designed to identify and reconcile customer identities across multiple purchases. It tracks customer contact information in a relational database and consolidates contact data based on provided email or phone number.
- Framework: Node.js with Express
- Database: PostgreSQL
- ORM: Sequelize
- Deployment: Render.com
- Identify and reconcile customer identities based on email and/or phone number.
- Link multiple contacts under a primary contact.
- Consolidate and return contact information, including primary and secondary contacts.
The API is deployed at: https://bitespeed-backend-ern2.onrender.com
POST /api/identify
{
"email": "string",
"phoneNumber": "string"
}
- Either email or phoneNumber must be provided. Response Body
{
"contact": {
"primaryContactId": number,
"emails": ["string"],
"phoneNumbers": ["string"],
"secondaryContactIds": [number]
}
}
- Node.js installed (version 14 or later)
- PostgreSQL installed and running
git clone https://github.com/yourusername/bitespeed-backend.git
cd bitespeed-backend
Copy code
npm install
Create a .env
file in the root directory and add your database configuration:
env
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=your_db_port
DB_DIALECT=postgres
Make sure your database is created and then run the migrations:
npx sequelize-cli db:migrate
npm run dev
The server will start on http://localhost:3000.
To test the API locally, you can use a tool like Postman or curl.
curl -X POST http://localhost:3000/api/identify -H "Content-Type: application/json" -d '{"email":"[email protected]", "phoneNumber":"123456"}'
- Open Postman.
- Create a new POST request.
- Set the URL to http://localhost:3000/api/identify.
- Set the
Content-Type
header toapplication/json
. - In the body, use raw JSON format to send the request:
{
"email": "[email protected]",
"phoneNumber": "123456"
}