main.js
798 Bytes
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!')
});