Skip to content

Commit

Permalink
Added invalid routes handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aledipa committed Jun 25, 2023
1 parent 2861373 commit 7d3a478
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ app.get('/terms', (req, res) => {
res.sendFile(__dirname + '/views/terms.html');
});

// Handling non existing page request
app.get('*', (req, res) => {
res.redirect('/')
});

// Handling search request
app.get('/result', (req, res) => {
if (req.query.search == '') { return res.redirect('/'); }
(async () => {
try {
// Tries to give the summary of the search
Expand Down

0 comments on commit 7d3a478

Please sign in to comment.