main.js
4.87 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
var express = require('express')
var app = express()
var fs = require('fs');
// var path = require('path');
// var qs = require('querystring');
// var sanitizeHtml = require('sanitize-html');
var template = require('./lib/template.js');
app.use(express.static('data'));
app.get('/', function(request, response) {
fs.readdir('./data', function(error, filelist){
var title = 'Health Care';
var description = '오늘은 얼마나 먹었어요?';
var list = template.list(filelist);
var ch='15ch'
var html = template.HTML(title,ch,'', list,
`<h1 style="font-size: 50px; text-align: center; ">${description}</h1>`,
`<div id = "login-ing" style="width:100%; text-align: center; margin-top: 5ch">
<div class="form-inline">
<form action="/login" method="post">
<label>ID</label>
<input type="text" name="name" class="form-control" placeholder="홍길동" style="width:200px;">
     
<label>Password</label>
<input type="password" name="birth" class="form-control" placeholder="*******" style="width:200px;">
<br><br><br>
<input type="submit" value="Login" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
</form>
<br><br>
<form action="/signup" method="get">
<input type="submit" value="Sign Up" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
</form>
</div>
</div>`
);
response.send(html);
});
});
app.get('/signup', function(request, response) {
fs.readdir('./data', function(error, filelist){
var title = 'Sign Up Page';
var description = '오늘은 얼마나 먹었어요?';
var list = template.list(filelist);
var ch='5ch'
var html = template.HTML(title,ch,`<link rel="stylesheet" type="text/css" href="./a.css" />`, list,
`<h1 style="width: 100%; text-align: center; font-size: 40px;">${description}</h1>`,
`<div id = "signup-ing" style="width:100%; text-align: center;">
<form action="/starting" method="post">
<div class="form-inline">
<div class="input-area">
<span class="input-label">
<label name="ID">ID</label>
</span>
<span class="input-box">
<input type="text" name="ID" >
</span>
</div>
<div class="input-area">
<span class="input-label">
<label name="Password">Password</label>
</span>
<span class="input-box">
<input type="text" name="Password" >
</span>
</div>
<div class="input-area">
<span class="input-label">
<label name="age">나이(세)</label>
</span>
<span class="input-box">
<input type="text" name="age" >
</span>
</div>
<div class="input-area">
<span class="input-label">
<label name="male/female">성별</label>
</span>
<select id="male/female" style="width: 200px; ">
<option>성별 선택</option>
<option>남자</option>
<option>여자</option>
</select>
</div>
<div class="input-area">
<span class="input-label">
<label name="height">키(cm)</label>
</span>
<span class="input-box">
<input type="text" name="height" >
</span>
</div>
<div class="input-area">
<span class="input-label">
<label name="weight">체중(kg)</label>
</span>
<span class="input-box">
<input type="text" name="weight" >
</span>
</div>
<br><br><br>
<input type="submit" value="Sign Up" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
</div>
</form>
</div>`
);
response.send(html);
});
});
app.listen(3000, function() {
console.log('Example app listening on port 3000!')
});