generated from lighthouse-labs/node-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Create_poll.txt
54 lines (41 loc) · 884 Bytes
/
Create_poll.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
What data do I need from the user?
Create Poll
Form (action="/polls")
Email (Text Input)
Name (Text Input)
Question (Text Input)
voter (Object)
name: string
email: string
Options (List)
Add option
Remove option
Edit
input needs a name=
CLIENT
<form id="poll" action="/polls">
<input name="email" type="text>```
<input name="name" type="text>
<input name="options[0]" type="text>
<input name="voter[name]"
</form>
</form
$('#poll').appendChild('<input name="option[index]">')
Once user submits
Form created (post request containing poll data from user)
- server gets that
= creates new UID and saves it to the database (poll)
- response back to browser - random unique/id
SERIES OF GET AND POSTs
SERVER
request.body => {
email: '',
name: '',
options: {
0: 'options text',
1: 'more text'
}
'option text',
]
,
}