New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send custom 404 page if it exists #34

Merged
merged 3 commits into from Oct 24, 2016

Conversation

2 participants
@taravancil
Copy link
Contributor

taravancil commented Oct 24, 2016

This checks if 404.html exists in the current directory and on 404s sends that instead of the default Not Found response.

@leo
Copy link
Member

leo left a comment

Great addition! 😊 Just a few tiny things that need to be changed before we can merge it.

bin/list Outdated

try {
const custom404Path = path.join(current, '/404.html')
notFoundResponse = fs.readFileSync(custom404Path, 'utf-8')

This comment has been minimized.

@leo

leo Oct 24, 2016

Member

Can you make this use await? Like here.

bin/list Outdated
const custom404Path = path.join(current, '/404.html')
notFoundResponse = fs.readFileSync(custom404Path, 'utf-8')
} catch (err) {
notFoundResponse = 'Not Found'

This comment has been minimized.

@leo

leo Oct 24, 2016

Member

I also recommend making this catch (err) {} and set 'Not Found' as the default value of notFoundResponse instead.

@leo leo self-assigned this Oct 24, 2016

@taravancil

This comment has been minimized.

Copy link
Contributor Author

taravancil commented Oct 24, 2016

Cool! I just pushed those changes. Lmk if you need any others 😊

@leo leo merged commit a7bbc67 into zeit:master Oct 24, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@leo

This comment has been minimized.

Copy link
Member

leo commented Oct 24, 2016

Thanks a lot - that was all! 😊 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment