This commit is contained in:
Matt Walsh
2022-12-07 10:53:18 -06:00
parent 8e6fd04b3a
commit 49cd15a688
16 changed files with 1406 additions and 478 deletions

View File

@@ -30,12 +30,19 @@ const index = (req, res) => {
});
};
// main page
app.get('/index.html', index);
app.get('/', index);
// fallback
app.get('*', express.static(path.join(__dirname, './server')));
// debugging
if (process.env?.DIST !== '1') {
// debugging
app.get('/index.html', index);
app.get('/', index);
app.get('*', express.static(path.join(__dirname, './server')));
} else {
// distribution
app.use('/images', express.static(path.join(__dirname, './server/images')));
app.use('/fonts', express.static(path.join(__dirname, './server/fonts')));
app.use('/scripts', express.static(path.join(__dirname, './server/scripts')));
app.use('/', express.static(path.join(__dirname, './dist')));
}
const server = app.listen(port, () => {
console.log(`Server listening on port ${port}`);