Here it is:
( result.username === user.username ) ? res.status( 500 ).json( "That username is already taken." ) : res.status( 500 ).json( "That email has already been used." )
Shouldn't this do the first thing, res.status( 500 ).json( "That username is already taken." )
, if the condition is true? Instead, it says:
[TypeError: undefined is not a function]
This works as expected.
if ( result.username === user.username ) return res.status( 500 ).json( "That username is already taken." )
else return res.status( 500 ).json( "That email has already been used." )
Sorry if I'm still not spotting the typo.