Ask coding questions

← Back to all posts
unavoidable error
nanasv (0)

It seems that replit don't accept this syntax, but it is legal. Usage of "async",before function.
No matter how I treat the function am still seen an error please help

exports.CreateAccount = async (req, res, next) => {
    try {
        let obj = req.body;
        const validateUserInput = await UserValidator.validateAccount(obj);
        if (!validateUserInput.passed) {
            return res.status(400)
                .json({
                    status: false,
                    code: 400,
                    message: "There's error in your inputs",
                    errors: validateUserInput.errors,
                })
        }
Comments
hotnewtop
Coder100 (18071)

did you attach the wrong repl? Nowhere is this code found.

nanasv (0)

@Coder100
I have sent the project, what should I do to correct the errors