title: How to group routes in gin?
body: <p>I want to group my routes in different files, so the main file won't be very messy.</p>
  <p>I want something like this in their own files:</p>
  <pre class="lang-golang prettyprint-override"><code>v1 := router.Group(&quot;/v1&quot;)
  {
    v1.Group(&quot;users&quot;, usersRoutes)
    v1.Group(&quot;pictures&quot;, picturesRoutes)
    v1.Group(&quot;friends&quot;, friendsRoutes)
  }
  </code></pre>
  <p>So each one of the <code>*Routes</code> would look something like this:</p>
  <pre class="lang-golang prettyprint-override"><code>users := v1.Group(&quot;/users&quot;)
  {
    users.GET(&quot;/&quot;, getUsers)
    users.POST(&quot;/&quot;, createUser)
  }
  </code></pre>
  <p>Is this possible? Right now my code looks like this:</p>
  <pre class="lang-golang prettyprint-override"><code>package app
  
  import (
      &quot;net/http&quot;
  
      &quot;github.com/gin-gonic/gin&quot;
  )
  
  func getUrls() {
      v1 := router.Group(&quot;/v1&quot;)
      {
          ping := v1.Group(&quot;/ping&quot;)
          {
              ping.GET(&quot;/&quot;, pongFunction)
          }
          users := v1.Group(&quot;/users&quot;)
          {
              users.GET(&quot;/&quot;, getUsersFunction)
          }
      }
  }
  </code></pre>
  <p>But this is going to increase its size a lot.</p>