fac21/week6-app-jcnr

Server crashes on sign up

Closed this issue · 1 comments

const { email, password, username } = request.body;

I think it's because you're expecting a username value, but the input in the form has name="name". So the username variable you pass into the model is undefined. Since the scheme says that column is NOT NULL Postgres is probably throwing an error that isn't getting caught, crashing the whole server.

As a more general issue: you need to have .catchs on all the promises in your routes, otherwise you'll get unhandled rejection errors that Express' default error-handler cannot catch. Even a basic "catch then send <h1>Something went wrong</h1>" would be better than the server crashing