-
Notifications
You must be signed in to change notification settings - Fork 5
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
Hello 👋(Code-Review) #80
Comments
Cheers man. I am a little confused about the 500 error still, are you saying it should be on the front end? Rather than the Backend? Or should I have one in both? Your suggestions have definitely helped! Really useful for fixing certain glaring errors. Also, have you looked at our routes tests on the front end? Do you think I should test every route? Also do you think it might be a good idea to somehow test the URL or status code on the front end rather than the text in the first element? |
Hi @harryyy27 You want both for a 500 error. A 500 error means an Internal Server Error, so you definitely want to catch it first from the backend. You've almost setup the 500 error route (don't forget about the bug mentioned in #74): app.use((err, req, res, next) => {
res.status(500)
res.render('500') // res.render() will throw an error because you're not using a rendering engine
// you want res.send(); instead
}) Once you send the 500 response back to the client - one option would be to route the user to an error page. For example, in fetch('/api/contactUs', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: data
})
.then(res => console.log(res))
.catch(err => {
console.log('ERROR IS', err)
this.props.history.push('/server-error');
}) Then you could have a You don't have to do this exact approach, but the general idea is:
Does that make sense? |
Your front end tests look good. I haven't used What I would say is try not to test things about the implementation that need to be flexible. For example, if the text-content is going to be changed and updated, it's probably not going to helpful to test (your tests will keep breaking). Testing things that should remain consistent will be useful. For example:
|
Hey people 👋
Great work so far 🎉 You've been able to keep a good balance of front-end / back-end / documentation / tests. I know you've decided to switch DBs to Airtable which has set you back a little, but you're doing an excellent job so keep it up 👍
I'm aware you've only got a week left, so feel free to ignore my suggestions if you've got more urgent things to focus on. Hopefully they will also be useful for future projects.
Also please do let me know if I've said something which doesn't make sense, and apologies if you were already aware of an issue, or you had a good reason for doing something a certain way.
Best of luck for the final MVP 🥇
The text was updated successfully, but these errors were encountered: