<?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: Phani-Devarapu</title>
    <description>The latest articles on DEV Community by Phani-Devarapu (@phanidevarapu).</description>
    <link>https://dev.to/phanidevarapu</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F558988%2F5235bc69-5c4c-407b-a8c8-fe5d9ed68e29.png</url>
      <title>DEV Community: Phani-Devarapu</title>
      <link>https://dev.to/phanidevarapu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phanidevarapu"/>
    <language>en</language>
    <item>
      <title>Deploying an Angular app on Netlify</title>
      <dc:creator>Phani-Devarapu</dc:creator>
      <pubDate>Fri, 29 Jan 2021 05:35:01 +0000</pubDate>
      <link>https://dev.to/phanidevarapu/deploying-an-angular-app-on-netlify-40o</link>
      <guid>https://dev.to/phanidevarapu/deploying-an-angular-app-on-netlify-40o</guid>
      <description>&lt;p&gt;Hello Guys, this is my first ever post in the DEV community. In this post I am going to explain how to deploy an angular application on Netlify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Netlify&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As per the docs&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Netlify is an all-in-one platform for automating modern web projects. Replace your hosting infrastructure, continuous integration, and deployment pipeline with a single workflow. Integrate dynamic functionality like serverless functions, user authentication, and form handling as your projects grow.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But for me netlify is a platform, which can deploy and host web apps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an Angular app from the CLI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Browse to your required directory and run the following commands to create an angular app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng new angular-netlify
ng serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command is to create an angular app in your directory and the second command will make sure your app is up and running in the localhost.&lt;/p&gt;

&lt;p&gt;You can view your angular app in the browser at &lt;a href="http://localhost/4200"&gt;http://localhost/4200&lt;/a&gt; address&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Changes to Angular app to deploy on Netlify&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a file named &lt;strong&gt;_redirects&lt;/strong&gt; in the &lt;em&gt;src&lt;/em&gt; folder and insert the below line.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*  /index.html 200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More about the &lt;a href="https://www.netlify.com/blog/2019/01/16/redirect-rules-for-all-how-to-configure-redirects-for-your-static-site/#:~:text=The%20_redirects%20file%20The%20most%20common%20strategy%20to,a%20folder%20called%20build/%20,%20or%20public/%20."&gt;_redirects&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;angular.json&lt;/strong&gt; file goto &lt;em&gt;projects.architect.build.options.assets&lt;/em&gt; and add the following
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
                "glob": "_redirects",
                "input": "src",
                "output": "/"
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deploy app into Netlify&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;First of all, you need an account with Netlify. If you don't have it please use this &lt;a href="https://app.netlify.com/"&gt;Netlify Signup&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can deploy our app either by uploading the files or by connecting git repository to the Netlify account. I prefer connecting git repo with netlify, because it has certain advantages which, we will discuss in the later posts.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Connecting git repo to netlify&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After successful signup and login to netlify account, you will see a dash board which looks similar to this&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U6uVgEC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5rozgftkpiduorrw4t9f.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U6uVgEC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5rozgftkpiduorrw4t9f.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click in the &lt;em&gt;New site from Git&lt;/em&gt;. A new screen will pop-up asking you login through Github/Gitlab/Bitbucket. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cs-1ojmj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b332aviowthhbun01lzc.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cs-1ojmj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b332aviowthhbun01lzc.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After successful login you have to &lt;em&gt;Authorize&lt;/em&gt; netlify on behalf of yourself to access the repo's. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gp90Xa84--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nc9yu63bwqg0xk4vtyxj.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gp90Xa84--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nc9yu63bwqg0xk4vtyxj.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, select corresponding repo and proceed through next steps, where you will need to configure the build settings.&lt;/p&gt;

&lt;p&gt;Make sure, you have selected proper branch, where the code is located.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z-BG7gC3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jq8cnnmku234af1ix68a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-BG7gC3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jq8cnnmku234af1ix68a.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And also make sure, the publish directory to dist/[your app name], in my case it is as shown in the below pic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NQU2F4HK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5velxeyc1klcvmgkk52m.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NQU2F4HK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5velxeyc1klcvmgkk52m.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you are good to &lt;strong&gt;HIT&lt;/strong&gt; the deploy site button. It will take a few minutes to deploy your app and it will give you an URL, from where you can access your deployed app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
We will add Authentication using Firebase in the next post.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>netlify</category>
      <category>firstpost</category>
      <category>deployment</category>
    </item>
  </channel>
</rss>
