title: NestJS - Default (wildcard) route?
body: <p>In my Angular app, if I load the home page <code>/</code> and then navigate to, say, <code>/products</code>, it works fine (it's a lazy-loaded module). But if now I reload the page, the browser makes a <code>GET /products</code> call to the server, which results in a 404.</p>
  
  <p>The solution is to send <code>index.html</code> and the Angular app is back on rails. So in Express I do <code>app.all("*", (req,res) =&gt; { res.sendFile("index.html") })</code> and it works.</p>
  
  <p>How to do the same thing in Nest?</p>
  
  <p>There is a <code>@All</code> decorator, but each controller in a given component handles a subroute, for instance <code>@Controller("cats")</code> will match <code>/cats</code> routes, so if I add <code>@All</code> in this controller, it will match only <code>/cats/*</code>, not <code>*</code>.</p>
  
  <p>Must I really create a whole separate module with a controller, just for this? That's what I did</p>
  
  <pre><code>@Controller() // Matches "/"
  export class GenericController {
  
      @All() // Matches "*" on all methods GET, POST...
      genericFunction(){
          console.log("Generic route reached")
      }
  }
  </code></pre>
  
  <p>And in my main module :</p>
  
  <pre><code>@Module({
      imports: [
          ItemsModule, // Other routes like /items
          GenericModule, // Generic "*" route last
      ],
  })
  </code></pre>
  
  <p>It works, but it seems overkill. Is this the way to go or is there a simpler trick?</p>