How to use the ts-express-decorators.InjectorService.factory function in ts-express-decorators

To help you get started, we’ve selected a few ts-express-decorators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scopsy / node-typescript-starter / src / dal / User.ts View on Github external
bcrypt.genSalt(10, (err, salt) => {
        if (err) return next(err);

        bcrypt.hash(String(user.password), salt, null, (err, hash) => {
            if (err) return next(err);

            user.password = hash;
            next();
        });
    });
}

export type UserInstance = InstanceType;
export type UserRepository = ModelType;
InjectorService.factory(UserRepositoryToken, new User().getModelForClass(User));