How to Serve Both API Website and API Under the Same URL

I’m currently working on an API website that provides users with APIs to retrieve movie information in JSON format. The very first challenge I met when designing the overall architecture was how can I serve my front-end web pages together with backend APIs under the same URL, i.e. if a user enters

https://www.dummy.com/

the server will return the website home page so user can signup for a free API key/ browse document to learn how to use the API; if a user enters

https://www.dummy.com…