Fix Class app http controllers controller does not exist laravel

How to Fix Class app http controllers controller does not exist laravel error which occurs mostly when working with API.

Firstly import the controller using the namespace

use App\Http\Controllers\AuthController;

Secondly Use the Controller On your route this way

Route::post("/users", [AuthController::class'register']);