Merge branch 'yong' into 'master'
일단 메인js만듬 잘 돌아감 See merge request !2
Showing
4 changed files
with
92 additions
and
0 deletions
File moved
File moved
lib/template.js
0 → 100644
| 1 | +module.exports = { | ||
| 2 | + HTML:function(title, list, body){ | ||
| 3 | + return ` | ||
| 4 | + <!DOCTYPE html> | ||
| 5 | +<html lang="en"> | ||
| 6 | +<head> | ||
| 7 | + <meta charset="UTF-8"> | ||
| 8 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 9 | + <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| 10 | + <title>${title}</title> | ||
| 11 | + <script src="jquery.js"></script> | ||
| 12 | + <script> | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + </script> | ||
| 16 | + <style > | ||
| 17 | + | ||
| 18 | + #footer { | ||
| 19 | + position: absolute; | ||
| 20 | + bottom: 0; | ||
| 21 | + width: 100%; | ||
| 22 | + height: 50px; | ||
| 23 | + text-align: center; | ||
| 24 | + color: white; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + </style> | ||
| 28 | +</head> | ||
| 29 | +<body> | ||
| 30 | + <img src = > | ||
| 31 | + ${body} | ||
| 32 | + <br><br><br> | ||
| 33 | + | ||
| 34 | + <div style="width:100%; text-align: center; "> | ||
| 35 | + <form action="/starting" method="post"> | ||
| 36 | + <div class="form-inline"> | ||
| 37 | + <label>ID</label> | ||
| 38 | + <input type="text" name="name" class="form-control" placeholder="홍길동" style="width:200px;"> | ||
| 39 | +       | ||
| 40 | + <label>Password</label> | ||
| 41 | + <input type="text" name="birth" class="form-control" placeholder="*******" style="width:200px;"> | ||
| 42 | + <br><br><br> | ||
| 43 | + <input type="submit" value="Login" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;"> | ||
| 44 | + </div> | ||
| 45 | + </form> | ||
| 46 | + </div> | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + <div id="footer">오픈소스SW Project 2019-1 고다경 김용재 김태희</div> | ||
| 50 | +</body> | ||
| 51 | +</html> | ||
| 52 | + `; | ||
| 53 | + },list:function(filelist){ | ||
| 54 | + var list = '<ul>'; | ||
| 55 | + var i = 0; | ||
| 56 | + while(i < filelist.length){ | ||
| 57 | + list = list + `<li><a href="/healthcare/${filelist[i]}">${filelist[i]}</a></li>`; | ||
| 58 | + i = i + 1; | ||
| 59 | + } | ||
| 60 | + list = list+'</ul>'; | ||
| 61 | + return list; | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
main.js
0 → 100644
| 1 | +var express = require('express') | ||
| 2 | +var app = express() | ||
| 3 | +var fs = require('fs'); | ||
| 4 | +// var path = require('path'); | ||
| 5 | +// var qs = require('querystring'); | ||
| 6 | +// var sanitizeHtml = require('sanitize-html'); | ||
| 7 | +var template = require('./lib/template.js'); | ||
| 8 | + | ||
| 9 | +app.get('/', function(request, response) { | ||
| 10 | + fs.readdir('./data', function(error, filelist){ | ||
| 11 | + var title = 'Health Care'; | ||
| 12 | + var description = '오늘은 얼마나 먹었어요?'; | ||
| 13 | + var list = template.list(filelist); | ||
| 14 | + var html = template.HTML(title, list, | ||
| 15 | + `<div id="banner" > | ||
| 16 | + | ||
| 17 | + <h1 style="font-size: 50px; text-align: center; ">${description}</h1> | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + </div>` | ||
| 21 | + ); | ||
| 22 | + response.send(html); | ||
| 23 | + }); | ||
| 24 | + }); | ||
| 25 | + | ||
| 26 | + app.listen(3000, function() { | ||
| 27 | + console.log('Example app listening on port 3000!') | ||
| 28 | + }); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment