title: Deployment of a socket.io app, how to avoid accidentally breaking prod by shipping to localhost instead of hosted backend?
body: <p>When developing/iterating fast, I flip the comment to enable localhost. When deploying or testing end to end, I flip the comment to use herokuapp. Seems finicky to flip things at the last moment before shipping, and I've already forgotten twice and pushed the wrong thing to main (heroku deploys off of main).</p>
  <pre><code>const socket = io('https://ramrod-garden-11633.herokuapp.com/'); // Set up on Heroku
  // const socket = io('http://localhost:3000');
  </code></pre>
  <p>Is there a standard way to make it work automatically?</p>
  <p>One way would be an environmental variable on Heroku and checking for its existence here (I think~~, new to frontend and not sure if environmental variable is a concept for frontend js). As I'm a noobie and this is my first app, wondering if there's a best practice here or standard way I missed.</p>