How to create custom module in Drupal 9?

Drupal is a powerful and most used content management system (CMS) that allows you to create custom modules to extend its functionality. In this blog post, we will walk through the process of creating a custom module in Drupal 9.
First, let’s create a new folder in the “modules/custom” directory of your Drupal installation and name it “hello_world”. It is standard practice to create “custom” directory inside the “modules” directory.
Inside the “hello_world” directory, create a new file called “hello_world.info.yml” and add the following code:
It is required file to create custom module.
File: hello_world.info.yml
Next, create a new file called “hello_world.routing.yml”, this file is used to create URLs to access the page. Inside this file add the following code:
File: hello_world.routing.yml
This code defines a new route for your custom module, which will be accessible at the path “/hello-world” on your website.
Now, let’s create the controller that will handle this route. To create controller, create two directories inside "hello_world" module directory. “src/Controller” and inside the Controller folder, create the “HelloWorldController.php” file
File: HelloWorldController.php
This controller defines a single method called “message” that returns a render array with the message “Hello World” on the frontend of the website.
Finally, you need to enable the module from the Drupal’s administration interface and can access the route ‘/hello-world’ URL it will show a “Hello World” message on your page.
You can clone the code from this GitHub repo Hello World Module Link.
Also, you can watch the below Drupal video tutorial on How to create custom module in Drupal 9?