我是javascript和web开发的初学者。我刚开始开发我的第一个员工出勤记录网站,当单击按钮时,日期、打卡时间和上课时间存储在数据库中。我正在使用neDB存储数据。我可以成功地将数据存储在数据库中,但我不知道如何在网页上以表格形式显示数据。
app.post("/attendance", (req, res) => {
console.log("I got a request");
const data = req.body;
database.insert(data);
res.json({
Status: "Success",
date: req.body.date,
clockintime: req.body.clockIn,
clcokouttime: req.body.clockOut
});
});
// To display on the web page
app.get('/history', (req, res) => {
// res.json({test:123});
console.log("I request");
database.find({}, (err, data) => {
if (err) {
res.end();
return;
}
res.json(data);
});
});
在此处输入图像描述
The image shown above is how it display on the webpage. However, i want in tablular form as shown in the 2nd image. 在此处输入图像描述. I would be very grateful if somebody can help me out with this.