Skip to content

Commit

Permalink
Merge pull request #4 from sarthakpranesh/tests
Browse files Browse the repository at this point in the history
chore: fixing express static's weird behaviour when trying to serve index.html
  • Loading branch information
SebastianStehle authored Mar 24, 2024
2 parents d5108f6 + d49a1b5 commit e036536
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ app.put('/api/:tokenRead/:tokenWrite', async (request, response) => {
return response.status(201).json({ readToken: tokenRead, writeToken: tokenWrite });
});

app.use("/*", express.static(path.join(__dirname, './ui/dist')))
app.use(express.static(path.join(__dirname, './ui/dist'), {}))
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, './ui/dist/index.html'));
});

app.listen(serverPort, () => console.log(`Listening on http://127.0.0.1:${serverPort}`));
app.listen(Number(serverPort), () => console.log(`Listening on http://127.0.0.1:${serverPort}`));

0 comments on commit e036536

Please sign in to comment.