title: Firebase function get parameter from URL
body: <p>I want to have a custom url like <code>https://&lt;my-project-id&gt;.firebaseapp.com/parameter</code> such that I have a function that takes in the value '<strong>parameter</strong>'.</p>
  
  <p>Here is what I have for firebase.json rewrites:</p>
  
  <pre><code>"rewrites": [
        {
          "source": "/:bar*", "function": "foo"
        },
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
  </code></pre>
  
  <p>And then for functions/index.js here is my 'foo' function:</p>
  
  <pre><code>exports.foo = functions.https.onRequest((req, res) =&gt; {
    console.log('bar = '+req.query.bar);
    console.info(req.query.bar);
    res.status(200).send(`&lt;!doctype html&gt;
      &lt;head&gt;
        &lt;title&gt;Test&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        Bar = ${req.query.bar}
      &lt;/body&gt;
    &lt;/html&gt;`);
  });
  </code></pre>
  
  <h2>What works, but is not what I want</h2>
  
  <p>If I change firebase.json to the following:</p>
  
  <pre><code>"rewrites": [
        {
          "source": "/**", "function": "foo"
        },
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
  </code></pre>
  
  <p>And write the url like this: </p>
  
  <pre><code>https://&lt;my-project-id&gt;.firebaseapp.com/anything?bar=test
  </code></pre>
  
  <p>then it properly gets the <strong>bar</strong> parameter. However, I need to be able to have the url shorter.</p>