express: serve up the frontend js asset

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-09-15 07:02:14 -04:00
parent 44167de812
commit 094465b9a7
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
3 changed files with 89 additions and 87 deletions

View file

@ -18,7 +18,6 @@ const db = new sqlite3.Database('mydb.db', (err) => {
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
time_difference INTEGER -- Add this column for time difference
)
`);
}
});
@ -29,6 +28,9 @@ app.use(bodyParser.json());
app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html');
});
app.get('/asset/frontend.js', (req, res) => {
res.sendFile(__dirname + '/asset/frontend.js');
});
// Route to get a random animal name
app.get('/getRandomAnimal', async (req, res) => {