title: What is an http request multiplexer?
body: <p>I've been studying golang and I noticed a lot of people create servers by using the <code>http.NewServeMux()</code> function and I don't really understand what it does.</p>
  
  <p>I read this:</p>
  
  <blockquote>
    <p>In go ServeMux is an HTTP request multiplexer. It matches the URL of
    each incoming request against a list of registered patterns and calls
    the handler for the pattern that most closely matches the URL.</p>
  </blockquote>
  
  <p>How is that different than just doing something like:</p>
  
  <pre><code>http.ListenAndServe(addr, nil)
  http.Handle("/home", home)
  http.Handle("/login", login)
  </code></pre>
  
  <p>What is the purpose of using multiplexing?</p>