what am I doing here wrong, that my supertokens th...
# general
m
what am I doing here wrong, that my supertokens throws a 500 error
Copy code
javascript
const { handleError } = require('../middleware');
const mongoose = require('mongoose');
const { validationResult } = require('express-validator');
const {  } = require("supertokens-node/recipe/emailverification");
const { signUp, signIn } = require("supertokens-node/recipe/emailpassword");

const register = async (req, res) => {
  try {
    const errors = validationResult(req);
    if (!errors.isEmpty()) throw { code: 400, message: errors.array() };
    const { email, password } = req.body;
    const result = await signUp(email, password);
    res.status(200).json(result.user);
  } catch (err) {
    handleError(res, err);
  }
}
2 Views