<?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: Bhautik</title>
    <description>The latest articles on DEV Community by Bhautik (@bhautikchudasama).</description>
    <link>https://dev.to/bhautikchudasama</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%2F87226%2F8ac3bebb-e431-4462-9f0e-5e8a1c35ecd9.jpg</url>
      <title>DEV Community: Bhautik</title>
      <link>https://dev.to/bhautikchudasama</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bhautikchudasama"/>
    <language>en</language>
    <item>
      <title>Deploy your ExpressJS app to zeit Now</title>
      <dc:creator>Bhautik</dc:creator>
      <pubDate>Fri, 20 Mar 2020 08:35:43 +0000</pubDate>
      <link>https://dev.to/bhautikchudasama/deploy-your-expressjs-app-to-zeit-now-448m</link>
      <guid>https://dev.to/bhautikchudasama/deploy-your-expressjs-app-to-zeit-now-448m</guid>
      <description>&lt;p&gt;&lt;strong&gt;🙄 What is Zeit?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ZEIT is the easiest way to deploy websites. Host your web projects with zero configuration, automatic SSL, and global CDN. You can visit their website &lt;a href="https://zeit.co/"&gt;https://zeit.co/&lt;/a&gt; and explore more things.&lt;/p&gt;

&lt;p&gt;In this article, we are going to deploy out expressjs web app to ▲ zeit now before we deep dive you have installed &lt;strong&gt;Node.js 10 LTS&lt;/strong&gt; on your machine and zeit account.&lt;/p&gt;

&lt;p&gt;Next install now globally on your machine using npm or yarn&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i -g now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installation configure your account&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ now login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clone my repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ https://github.com/BhautikChudasama/Node-with-zeit.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this repository, I created the template of expressjs web app and you can also replace your code in index.js &lt;/p&gt;

&lt;p&gt;Here is source code of &lt;em&gt;index.js&lt;/em&gt; that sends the response &lt;em&gt;Hello from zeit&lt;/em&gt; whenever &lt;strong&gt;/&lt;/strong&gt; and for other wildcards, such &lt;strong&gt;/any, /aa, /xyz&lt;/strong&gt; that sends &lt;em&gt;wild card&lt;/em&gt; in response&lt;/p&gt;

&lt;p&gt;Next we bind our app to 5000 port.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from zeit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;**&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wild card&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App is listening on port 5000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open your terminal and fire&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;that asks some basic questions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ now
? Set up and deploy “F:\zeit-demo”? [Y/n] y
? Which scope do you want to deploy to? Bhautik
? Link to existing project? [y/N] n
? What’s your project’s name? zeit-demo
? In which directory is your code located? zeit-demo/
�🔗  Linked to ** (created .now and added it to .gitignore)
�🔍  Inspect: URL [Hidden]
✅  Production: https://zeit-demo-six.now.sh [copied to clipboard] [42s]
�📝  Deployed to production. Run `now --prod` to overwrite later (https://zeit.ink/2F).  
�💡  To change the domain or build command, go to URL [Hidden]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✌️ After successful deployment that copied the production URL into the clipboard and now you can explore the app in your browser.&lt;/p&gt;

&lt;p&gt;Try open &lt;a href="https://zeit-demo-six.now.sh/"&gt;https://zeit-demo-six.now.sh/&lt;/a&gt; that show &lt;strong&gt;Hello from zeit&lt;/strong&gt; and &lt;a href="https://zeit-demo-six.now.sh/dev"&gt;https://zeit-demo-six.now.sh/dev&lt;/a&gt; that show &lt;strong&gt;wild card&lt;/strong&gt; in the response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you&lt;/strong&gt; for reading my first article in dev.to and you can follow me on twitter also @bhautiktweets 😊&lt;/p&gt;

</description>
      <category>zeit</category>
      <category>express</category>
      <category>node</category>
    </item>
  </channel>
</rss>
