-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadMe.txt
80 lines (59 loc) · 1.89 KB
/
readMe.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
please use npm i before npm start
Question 1: PrimeNumber
-> url:-localhost:3000/prime/50
Method:-GET
Here 50 is param or number passed in GET Method
-> json as Response:- {
"prime": [
2,
3,
5,
7,
11,
13,
17,
19,
23,
29,
31,
37,
41,
43,
47
]
}
Question 2: User creation and insertion
-> url:- localhost:3000/user/
Method:-POST
payload:-{
"name": "rahul",
"email": "[email protected]",
"password": "1234",
"address": "abc colony",
"phone": 9433003911,
"dob": "03-02-2020"
}
-> response:- {
"message": "Data Inserted Successfully to User and Contact Collection"
}
->response for phone or mail errors :-
{
"error": "Please enter correct email and phone"
}
Question 3: Contact Creation and deletion
Contact is getting created first then user is getting inserted where i am keeping the contact id as field contactref
in db and deleting it when delete is called from user route with phone number from body
->url:-localhost:3000/user/
->payload:-{
"phone": 8433003911
}
->response:-{
"message": "Data deleted Successfully from user and contacts "
}
->NoSuchRecordResponse:-{
"message": "Such Data Not Found! Cannot apply delete Operation"
}
mongo db User collection saved doc eg:-
{"_id":{"$oid":"5e7392046c70b5237816fb17"},"contactRef":{"$oid":"5e7392046c70b5237816fb18"},"name":"rahul","email":"[email protected]","password":"1234","address":"abc","phone":{"$numberDouble":"9433003921"},"dob":{"$date":{"$numberLong":"1583087400000"}},"__v":{"$numberInt":"0"}}
mongodb Contact collection saved doc eg:0
{"_id":{"$oid":"5e7392046c70b5237816fb18"},"email":"[email protected]","phone":{"$numberDouble":"9433003921"},"__v":{"$numberInt":"0"}}