blob: 87ddc0c9b21145b3b9a3186b7f34350a9eb037bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
const database = require('../source/database')
const estore = database('EStore')
class Shop {
constructor() {}
async Main() {
return estore.Query('SELECT * FROM Products').then(output => {
const data = {
start: `
<section id='shop'>
<div>
<h1>This is the Shop page</h1>
`,
body: '',
end: `
</div>
</section>
`
}
for (let i = 0; i < output[0].length; i++) {
data.body += `
<div class='item'>
<h2>${output[0][i].ProductName}</h2>
<p>ID: ${output[0][i].ID}</p>
</div>
`
}
return data.start + data.body + data.end
})
}
Product() {
const data = `
<section id='product'>
<div>
<h1>This is the Product page</h1>
<p>Description</p>
</div>
</section>
`
return data
}
}
module.exports = () => {return new Shop()}
|