| VARIABLE NAME | VALUE TO STORE |
|---|---|
| PORT | this is the port for server |
| DB_HOST | database host |
| DB_NAME | database name |
| DB_USER | database user |
| DB_PASS | data base password (leave empty if unnecessory error occurs) |
| REFREE_TABLE | table name of refree's ( table where data of refree's are stored) |
| LEADS_TABLE | table name of leads ( table where data for leads are stored) |
| ADMIN_PASS | password for admin to access admin APIs (admin has privelege to see all the data , give rewards, adn change status etc) |
| PASS_KEY | secret key for hashing the passwords |
- /api/admin/createTable (api for creating the table in database)
- /admin/login (POST api for login in to the admin panel)
{ "password" : "adminPassword" }
- /admin/getUsers (GET api for fetching all the Refrees in the app)
- /admin/getLeads (GET api for fetching all teh leads given by a refree )
{
"email" : "adarshprakashpandey@gmail.com"
}
- /admin/reward (PUT api for giving reward to a lead and hence to a refree)
{
"id" : "45",
"reward" : "78"
}
- /admin/status (PUT api for changing status of a lead)
{ "id" : "45", "status" : "junk" }
- /ref/login // POST api for logging in
{
"email" : "sankalppandey45@gmail.com",
"password" : "1234567"
}
{
"jwt" : "some jwt token",'
"message" : "Logged in Successfully"
}
-
/ref/signup // POST api for signing in
{ "first_name" : "Anil", "last_name" : "Singh", "email" : "anil@gmail.com", "phone" : "123456789", "password" : "password" } -
/ref/leads // GET api for fetching all the leads refered by the user
authorization header : "jwt jwt_token " -
/ref/addLead // PUT api for adding a new lead
authorization header : "jwt jwt_token " { "first_name" : "Anil", "last_name" : "Singh", "phone" : "123456789", "address" : "kahi to rehta hai ye" } -
/ref/leadsBetween (GET api for fetching leads between two date)
authorization header : "jwt jwt_token ", { "date_from" : "YYYY-MM-DD", "date_to" : "YYYY-MM-DD" }
before testing change DB_NAME in env variables to your test database name
npm test
you can also change table names in environment variables