POST_login(req, res, next) {
// The code to login...
}
Now, we want to create a module 'auth' that uses this same operation of 'login' module and add a new one specific to register.
We'll need to make 'app_modules/auth/index.js' look like this:
const Login = require('../login');
class Auth extends Login {
POST_register(req, res) {
// The code to register...
}
}
module.exports = Auth;
We can now post to /auth/register as well as you can post /auth/login.