You could achieve that in one of two ways (both consist of a redirect)
- You could use cloudflare page rules to redirect
example.com
toforum.example.com
or - You could set up nginx to perform this redirect for you. I believe discourse’ internal nginx is configured so that all requests coming in are redirected to discourse hostname. See: Redirect additional domain(s) to your Discourse instance
and Congratulations on getting your new discourse up & running.