김용재

일단 메인js만듬 돌아감

module.exports = {
HTML:function(title, list, body){
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>${title}</title>
<script src="jquery.js"></script>
<script>
</script>
<style >
#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 50px;
text-align: center;
color: white;
}
</style>
</head>
<body>
<img src = >
${body}
<br><br><br>
<div style="width:100%; text-align: center; ">
<form action="/starting" method="post">
<div class="form-inline">
<label>ID</label>
<input type="text" name="name" class="form-control" placeholder="홍길동" style="width:200px;">
&nbsp &nbsp&nbsp&nbsp
<label>Password</label>
<input type="text" 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;">
</div>
</form>
</div>
<div id="footer">오픈소스SW Project 2019-1 고다경 김용재 김태희</div>
</body>
</html>
`;
},list:function(filelist){
var list = '<ul>';
var i = 0;
while(i < filelist.length){
list = list + `<li><a href="/healthcare/${filelist[i]}">${filelist[i]}</a></li>`;
i = i + 1;
}
list = list+'</ul>';
return list;
}
}
\ No newline at end of file
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.get('/', function(request, response) {
fs.readdir('./data', function(error, filelist){
var title = 'Health Care';
var description = '오늘은 얼마나 먹었어요?';
var list = template.list(filelist);
var html = template.HTML(title, list,
`<div id="banner" >
<h1 style="font-size: 50px; text-align: center; ">${description}</h1>
</div>`
);
response.send(html);
});
});
app.listen(3000, function() {
console.log('Example app listening on port 3000!')
});
\ No newline at end of file