For separating the handlers into modules, the code uses the ServeMux for each module, (rest and ui). The handling of URLs for the given module is defined relatively. This means if the final URL for the Handler should be /api/users, then the defined path within the module would be /users. The module itself would be set to /api/ URL.
The module is plugged into the main ServeMux pointer named mainMux by leveraging the StripPrefix function, which removes the module prefix. For instance, the REST module created by the restModule function, is plugged into the main ServeMux by StripPrefix("/api",restModule()). The handled URL within the module will then be /users, instead of /api/users.