DEV Community

Discussion on: Your thoughts on Creating a New User

 
jessachandler profile image
Jess Chandler

Thanks for your thoughts. I was thinking that the "send confirmation email" is it's own function but is called kinda like so in the route handler -> action is createUser -> go to /api/user/new -> call createUser which ... checks to see if user already exists.then(create user).then(send confirmation email).then(go to login page or something else) - However, I'm not sure if you are saying that I should exit the createUser function and say now, go to send confirmation email.

Thread Thread
 
christiansk profile image
christiansk

I think what he means is that sending the e-mail should be done asynchronously in a separate thread/process/worker, thus not blocking your main thread. You can return a response to the user while the e-mail is still being sent in the background.

Thread Thread
 
jessachandler profile image
Jess Chandler

Thanks for your thoughts Christian!