17 lines
338 B
TypeScript
17 lines
338 B
TypeScript
import { usernameRegex } from "~/lib/server/constants";
|
|
import { User } from "~/models/user";
|
|
|
|
export default eventHandler(async (event) => {
|
|
const query = getQuery(event);
|
|
const u = await User.findOne({
|
|
email: query.email as string,
|
|
}).exec();
|
|
if (u) {
|
|
return {
|
|
exists: true,
|
|
};
|
|
} else {
|
|
return { exists: false };
|
|
}
|
|
});
|