Skip to content

Commit

Permalink
🌐 Forward Heroku to GitHubJobs.io #46 - Add Redirect in Server
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlee-dev committed Jul 31, 2020
1 parent d9dfa14 commit 9d01b91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class App {
this.app.use(express.static(path.join(__dirname, "../dist")));

this.app.get("*", (req: Request, res: Response) => {
console.log({ hostname: req.hostname });
if (req.hostname === "herokuapp") {
return res.status(308).redirect("https://www.githubjobs.io/");
}
res.sendFile(path.join(__dirname, "../dist/index.html"));
});
}
Expand Down

0 comments on commit 9d01b91

Please sign in to comment.