summaryrefslogtreecommitdiff
path: root/scripts/shop.js
diff options
context:
space:
mode:
authorMhykol <mchaeldonald62@pm.me>2024-05-03 10:56:46 -0400
committerMhykol <mchaeldonald62@pm.me>2024-05-03 10:56:46 -0400
commit8c814d79235a38465ef46052cf9a523d555a29e7 (patch)
tree1c50d136015e3759aa6c9743282692ed9d0df390 /scripts/shop.js
Initial commit
Diffstat (limited to 'scripts/shop.js')
-rw-r--r--scripts/shop.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/shop.js b/scripts/shop.js
new file mode 100644
index 0000000..87ddc0c
--- /dev/null
+++ b/scripts/shop.js
@@ -0,0 +1,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()}