Describe the bug
When a user creates an account that is already existing the server shuts down in an error:
node:internal/errors:477
ErrorCaptureStackTrace(err);
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:388:5)
at ServerResponse.setHeader (node:_http_outgoing:603:11)
at ServerResponse.header (/home/notaspoon/programming/websites/collab/Mental-Health-Tracker/server/node_modules/express/lib/response.js:794:10)
at ServerResponse.send (/home/notaspoon/programming/websites/collab/Mental-Health-Tracker/server/node_modules/express/lib/response.js:174:12)
at /home/notaspoon/programming/websites/collab/Mental-Health-Tracker/server/APIrouter.js:175:25
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_HTTP_HEADERS_SENT'
}
To Reproduce
Steps to reproduce the behavior:
Go to create account
Enter the exact same details of an account that already exists
It says "Account successfully registered"
The server shuts down. See error. The client gives no errors.
Expected behavior
Registering a user that already exists should return a normal error that does not crash the server.
Describe the bug When a user creates an account that is already existing the server shuts down in an error:
To Reproduce Steps to reproduce the behavior:
Expected behavior Registering a user that already exists should return a normal error that does not crash the server.