<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nimrod Munatsi</title>
    <description>The latest articles on DEV Community by Nimrod Munatsi (@nmunatsi).</description>
    <link>https://dev.to/nmunatsi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F823402%2F53c9ed08-f175-435c-b046-6cadbd95d945.png</url>
      <title>DEV Community: Nimrod Munatsi</title>
      <link>https://dev.to/nmunatsi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nmunatsi"/>
    <language>en</language>
    <item>
      <title>Static files not reading the .env file in a node js server</title>
      <dc:creator>Nimrod Munatsi</dc:creator>
      <pubDate>Tue, 01 Mar 2022 07:48:49 +0000</pubDate>
      <link>https://dev.to/nmunatsi/static-files-not-reading-the-env-file-in-a-node-js-server-34ah</link>
      <guid>https://dev.to/nmunatsi/static-files-not-reading-the-env-file-in-a-node-js-server-34ah</guid>
      <description>&lt;p&gt;I have a react app that i was able to build into static files which i then added to my node js app. after installing &lt;code&gt;dotenv&lt;/code&gt; and adding &lt;code&gt;require('dotenv').config()&lt;/code&gt; to &lt;code&gt;server.js&lt;/code&gt; in the node server application. The following peice of code i had in the react application does not seem to be working now although the static files are being rendered in the browser just fine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let node_server_url;
//TODO
// set the NODE_ENV on the .env file.
// create the .env file on the root of the project and add a NODE_ENV on the file
// e.g NODE_ENV=development or NODE_ENV=production

let urlConfig = (process.env.NODE_ENV === "production") ? {
    urlBackend: `https://mybluebookloanuat.bayportbotswana.com`,
} : {
    // urlBackend: `http://10.16.32.22:5000`,
    urlBackend: `http://localhost:5003`,
}

// eslint-disable-next-line
export default node_server_url = urlConfig.urlBackend;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;i want to be able to just set up in the &lt;code&gt;.env&lt;/code&gt; file the address for deverlopment and for production in the node server app. Can someone help me&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
      <category>env</category>
    </item>
  </channel>
</rss>
