Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김용재
/
Open_Source_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김용재
2019-05-31 17:19:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
665afe500f1c52a21a0665ee950cd03ad7d3ad0b
665afe50
1 parent
1adbd95b
일단 메인js만듬 돌아감
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
0 deletions
jquery.js → data/jquery.js
main.html → data/main.html
lib/template.js
main.js
jquery.js
→
data/
jquery.js
View file @
665afe5
File moved
main.html
→
data/
main.html
View file @
665afe5
File moved
lib/template.js
0 → 100644
View file @
665afe5
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;">
     
<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
main.js
0 → 100644
View file @
665afe5
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
Please
register
or
login
to post a comment