This is not using Dependency Injection and You are mutating the driver directly which is a bad programming practice.
Instead, we will update Driver class so we can call const driver = new Driver(req.body) the class Driver will have the responsibility of hashing the password and providing all the other methods that are needed.
This is not using
Dependency Injection
and You are mutating thedriver
directly which is a bad programming practice. Instead, we will updateDriver
class so we can callconst driver = new Driver(req.body)
the classDriver
will have the responsibility of hashing the password and providing all the other methods that are needed.