Check if username is taken when registering new user

Has anyone come across a workflow on how to check if a username is taken before registering a new user since the username has to be unique

System Information
  • Strapi Version: v4
  • Operating System:Windows
  • Database: sqlite
  • Node Version: 14
  • NPM Version: 8
  • Yarn Version:

In strapi 3, I just check it in the beforeCreate hook. You can also create a controller to check on the frontend as well