running my node server just returns a blank page, and not the front end.
Can someone provide some advice?
front end script tag
async function getSample() {
const res = await fetch('/');
const data = await res.text();
console.log(data);
}
document.getElementById('button').addEventListener
('click', getSample);
async function getSample() {
fetch('/')
.then(response => response.text())
.then(data => console.log(data));
}
back end script tag:
const express = require('express')
const app = require ('express')();
const port = 3000
app.use(express.static("Public"));
app.get('/', (req, res) => {
res.json()
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Any insight would be greatly appreciated as I am still learning
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…