A router is a mechanism that handles incoming HTTP requests and directs them to the appropriate endpoint or controller, based on the request's URL. Routers are a fundamental part of web applications and are used to map URLs to specific actions or resources within the application.