title: How is the name of the controller passed in this ASP.NET tutorial?
body: <p>I've been following along in <a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-3.1&amp;tabs=visual-studio" rel="nofollow noreferrer">this</a> ASP.NET tutorial. In the beginning of the controller, there is the following code:</p>
  <pre><code>[Route(&quot;api/[controller]&quot;)]
  [ApiController]
  public class BooksController : ControllerBase
  </code></pre>
  <p>From my understanding, the ApiController attribute declares this class as a controller, and the Route attribute declares the base route for all other routes in the controller.</p>
  <p>When you scroll down, they test the api with a URL of <code>http://localhost:&lt;port&gt;/api/books</code>. So this means that [controller] is equal to books. I can't find where this &quot;books&quot; is passed in as the controller name.</p>
  <p>The only time where some string &quot;books&quot; is passed in is in the appsettings.json file, and this is meant for the collection name in MongoDB. Also the string is &quot;Books&quot; not &quot;books&quot;.</p>
  <p>Also my second question is how does this replacement of [controller] with books work. Like what is the name of this syntax? I don't even know what to google to get more information.</p>