<?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: Kevin Wang</title>
    <description>The latest articles on DEV Community by Kevin Wang (@superwalnut).</description>
    <link>https://dev.to/superwalnut</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%2F464962%2F238bc38c-4bd1-497e-9289-b2d9a3c65216.png</url>
      <title>DEV Community: Kevin Wang</title>
      <link>https://dev.to/superwalnut</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/superwalnut"/>
    <language>en</language>
    <item>
      <title>Create a dotnet core Cosnole app template with autofac dependency injections</title>
      <dc:creator>Kevin Wang</dc:creator>
      <pubDate>Sat, 12 Sep 2020 10:37:36 +0000</pubDate>
      <link>https://dev.to/superwalnut/create-a-dotnet-core-cosnole-app-template-with-autofac-dependency-injections-5g0i</link>
      <guid>https://dev.to/superwalnut/create-a-dotnet-core-cosnole-app-template-with-autofac-dependency-injections-5g0i</guid>
      <description>&lt;p&gt;Every time I create a new project, I have to go through exactly same steps to setup some open source libraries that I always use for any projects.&lt;/p&gt;

&lt;p&gt;For example I often use autofac as my dependency inject container and register a bunch of services and preconfigure them the same way, such as Serilog, Automapper, etc.&lt;/p&gt;

&lt;p&gt;There is nothing difficult to setup all these libraries, it is just time consuming and repetitive job that has to be done every single time.&lt;/p&gt;

&lt;p&gt;So here I create this small template project that is pre-installed and pre-configured with all these libraries, to speed up your development process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Autofac&lt;/li&gt;
&lt;li&gt;Serilog&lt;/li&gt;
&lt;li&gt;AutoMapper&lt;/li&gt;
&lt;li&gt;Newtonsoft.Json&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install and use the template
&lt;/h2&gt;

&lt;p&gt;This is the link to the published &lt;a href="(https://www.nuget.org/packages/Superwalnut.NetCoreConsoleTemplate/)"&gt;nuget&lt;/a&gt; package as a dotnet template,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.nuget.org/packages/Superwalnut.NetCoreConsoleTemplate/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tm59tsqU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.mrkevin.wang/images/blog/nuget-logo.png" alt="nuget"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can install this template via nuget using &lt;code&gt;dotnet new -i&lt;/code&gt;,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new --install Superwalnut.NetCoreConsoleTemplate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The template will be installed as &lt;code&gt;core-console-autofac&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then you can create your new project using this template,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new core-console-autofac -n MyFirstConsole
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What is included in your new project
&lt;/h2&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ---- Models
        |---- Foo.cs
    ---- Modules
        |---- ConsoleModules.cs
    ---- AutoMapper
        |---- MyAutoMapperProfile.cs
    ---- appsettings.json
    ---- Program.cs
    ---- Startup.cs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Autofac
&lt;/h3&gt;

&lt;p&gt;I created a Startup.cs file to create autofac &lt;code&gt;ContainerBuilder&lt;/code&gt; and register all the services using &lt;code&gt;ConfigureServices()&lt;/code&gt; method. To keep service registrations neat and clean, I created an autofac module, for the services only consumed by the console app.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        private ContainerBuilder ConfigureServices(IServiceCollection serviceCollection)
        {
            CreateLogger(Configuration);

            serviceCollection.AddAutofac();
            serviceCollection.AddOptions();

            var builder = new ContainerBuilder();
            builder.Populate(serviceCollection);
            builder.RegisterLogger();

            builder.RegisterModule&amp;lt;ConsoleModule&amp;gt;();
            return builder;
        }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  appsettings.json
&lt;/h3&gt;

&lt;p&gt;I need to use &lt;code&gt;ConfigurationBuilder()&lt;/code&gt;, to read the physical app setting json file from its environment, and then &lt;code&gt;AddEnvironmentVariables()&lt;/code&gt;, so we can override configurations via environment variables.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#if DEBUG
            var builder = new ConfigurationBuilder()
                .SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
                .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                .AddEnvironmentVariables();
#else
            var builder = new ConfigurationBuilder()
                .SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
                .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                .AddJsonFile($"appsettings.{envName}.json", optional: true)
                .AddEnvironmentVariables();
#endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Serilog
&lt;/h3&gt;

&lt;p&gt;Registered the logger in &lt;code&gt;ConfigureService()&lt;/code&gt;,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        public static void CreateLogger(IConfigurationRoot configuration)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
                .Enrich.FromLogContext()
                .ReadFrom.Configuration(configuration)
                .CreateLogger();
        }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and configured with Console output sinks.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  "Serilog": {
    "Using": [ "Serilog.Sinks.Console" ],
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "Console"
      }
    ]
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  AutoMapper
&lt;/h3&gt;

&lt;p&gt;Created a default automapper profile with an example &lt;code&gt;CreateMap()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public class MyAutoMapperProfile : Profile
    {
        public MyAutoMapperProfile()
        {
            CreateMap&amp;lt;Foo, FooDto&amp;gt;();
            // Use CreateMap... Etc.. here (Profile methods are the same as configuration methods)
        }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Finally,
&lt;/h2&gt;

&lt;p&gt;Congratulations on setup your .net core console app with this template.&lt;br&gt;
If you find my article is helpful and saving you some time, please follow me at medium and share my post.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@mrkevin.wang/create-a-dotnet-core-cosnole-app-template-with-autofac-dependency-injections-60e09f27df17?sk=d831e88acc36319e2a43e8c7dac70238" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XAsqVpkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/0%2A78Cd7gCoYKfJbSKg.jpg" alt="Kevin W"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@mrkevin.wang/create-a-dotnet-core-cosnole-app-template-with-autofac-dependency-injections-60e09f27df17?sk=d831e88acc36319e2a43e8c7dac70238" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Create a dotnet core Cosnole app template with autofac dependency injections | by Kevin W | Sep, 2020 | Medium&lt;/h2&gt;
      &lt;h3&gt;Kevin W ・ &lt;time&gt;Sep 12, 2020&lt;/time&gt; ・ 2 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;Here is a link to github to grab the full source code.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/superwalnut"&gt;
        superwalnut
      &lt;/a&gt; / &lt;a href="https://github.com/superwalnut/dotnet-console-app-template"&gt;
        dotnet-console-app-template
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      This is a project template for .Net Core 3.1 console app, pre configured Autofac, Serilog, AutoMapper, Newtonsoft.Json
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>using github action to triage your nuget packages for .net solutions </title>
      <dc:creator>Kevin Wang</dc:creator>
      <pubDate>Thu, 10 Sep 2020 04:50:55 +0000</pubDate>
      <link>https://dev.to/superwalnut/using-github-action-to-triage-your-nuget-packages-for-net-solutions-29eg</link>
      <guid>https://dev.to/superwalnut/using-github-action-to-triage-your-nuget-packages-for-net-solutions-29eg</guid>
      <description>&lt;p&gt;Do you often work on a .net solution with many projects?&lt;/p&gt;

&lt;p&gt;Do you ever find Newtonsoft.Json is installed with different versions across the whole solution?&lt;/p&gt;

&lt;p&gt;And do you find some nuget packages are 5 years old that never have been updated or even been no longer maintained and unpublished?&lt;/p&gt;

&lt;p&gt;Or find your projects/solutions are using pre-released packages that are not very reliable for production usage?&lt;/p&gt;

&lt;p&gt;I have been struggling with these stuff during most of my projects. It is not a difficult task to fix them up, but it definitely requires some sort of trigger to examine the above scenarios regularly from time to time.&lt;/p&gt;

&lt;p&gt;So I am wondering if I can make it part of the CI/CD process, regularly perform checks against consumed nuget packages, for solutions/projects. With nuget.org’s public API and I chuck in some dotnet core to build a little console app to achieve sanity triage of all these installed nuget dependencies. And it works out really well for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here it comes NuSight
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/superwalnut/NuSight"&gt;NuSight&lt;/a&gt; is tiny .net core console app I built to help your triage your .net solutions for the nuget packages. It is open source and you can find the source code from &lt;a href="https://github.com/superwalnut/NuSight"&gt;github&lt;/a&gt;. Also it has been published to &lt;a href="https://www.nuget.org/packages/NuSight"&gt;nuget.org&lt;/a&gt; as a dotnet tool&lt;br&gt;
&lt;a href="https://www.nuget.org/packages/NuSight"&gt;&lt;strong&gt;NuSight 1.2.2&lt;/strong&gt;&lt;br&gt;
*This is a .net tool that analyze your solution folder, discover all your project files and diagnose all the nuget…*www.nuget.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To install it and use it, you need dotnet CLI and run this command,&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet tool install --global NuSight
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Use it with github actions
&lt;/h4&gt;


&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;[Note]: # Maintainer Must-Haves&lt;/p&gt;
&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Build-Nusight

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.1.301    
    - name: Install dependencies
      working-directory: ./NuSightConsole
      run: dotnet restore
    - name: Build
      working-directory: ./NuSightConsole
      run: dotnet build --configuration Release --no-restore
    - name: Nuget triage
      working-directory: ./NuSightConsole
      run: | 
        dotnet tool install -g NuSight
        nusight list -o -i -p -u
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/superwalnut/NuSight"&gt;https://github.com/superwalnut/NuSight&lt;/a&gt;&lt;/p&gt;

</description>
      <category>actionshackathon</category>
    </item>
    <item>
      <title>Create a COVID-19 dashboard with Angular 9+Serverless+AWS Lambda</title>
      <dc:creator>Kevin Wang</dc:creator>
      <pubDate>Thu, 10 Sep 2020 04:42:37 +0000</pubDate>
      <link>https://dev.to/superwalnut/create-a-covid-19-dashboard-with-angular-9-serverless-aws-lambda-5hma</link>
      <guid>https://dev.to/superwalnut/create-a-covid-19-dashboard-with-angular-9-serverless-aws-lambda-5hma</guid>
      <description>&lt;p&gt;Serverless computing is a cloud computing model in which a cloud provider automatically manages the provisioning and allocation of compute resources. I am creating a dashboard to demonstrate how to build an Angular 9 app and deploy it to AWS Lambda and then expose these for public consumption using API Gateway.&lt;/p&gt;

&lt;p&gt;**Prerequisites&lt;br&gt;
&lt;a href="https://nodejs.org/en/download"&gt;**Node 12&lt;/a&gt;&lt;br&gt;
&lt;a href="https://cli.angular.io/"&gt;Angular CLI&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html"&gt;AWS CLI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1. Build an angular app
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Create a new app&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start with creating the angular project by using angular cli named ‘angular-app’. Let’s add scss for styles and angular routers.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng new angular-app --style=scss --routing=true --inlineStyle=false
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can start the application by ng serve and test it in browser &lt;a href="http://localhost:4200/"&gt;http://localhost:4200/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s add some packages that we are going to use for the COVID-19 dashboard.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# add sass
npm i --save node-sass

# add bootstrap
ng add @ng-bootstrap/ng-bootstrap

# install chartjs
npm i --save chart.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I am going to create a dashboard with some statistics and graphs, such as daily world-wide statistics, daily increase graph, total cases world-wide, and timeline graph. The data source I have obtained from GitHub as a demonstration purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I use the ng command to create the following components.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# generate components
ng g c components/daily-increase

ng g c components/countries-summary

ng g c components/overall-timeline

ng g c components/overall-summary

ng g c components/mailing-list
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It should generated the components in this structure, with each component folder contains the following files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0TGpLpTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AZly-P3jmpiSEAdzslGfadw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0TGpLpTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AZly-P3jmpiSEAdzslGfadw.png" alt="angular component folder structure"&gt;&lt;/a&gt;&lt;em&gt;angular component folder structure&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And reference these components into our app.component&lt;/p&gt;

&lt;p&gt;Don’t forget add these components into our app.module as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Services&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I also need to create a service that would make api calls from a backend service and return some data for our graphs.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng g service services/covid
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It should generate a covid.service.ts under the services folder and I am using the http client to make http calls to retrieve some json data.&lt;/p&gt;

&lt;p&gt;Because I created these components as sub components inside app component and some of them are sharing the same data. So I am using Observable.subscribe() and Subject.next() to communicate between them.&lt;/p&gt;

&lt;p&gt;With the covid.service you can subscribe to new overall data in any component with getOverall() method,&lt;/p&gt;

&lt;p&gt;send overall data from any component (in this case I am calling it from app component) with the callOverall() method.&lt;/p&gt;

&lt;p&gt;by the way, I defined the api Url in our environment.ts that can be accessed globally across the whole application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a graph for daily-increase.component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I can modify each component and create whatever graphs and content we needed. I am taking the daily-increase component as an example. (for the rest you can get the source code from GitHub)&lt;/p&gt;

&lt;p&gt;I modify the daily-increase.component.html with a canvas that I am going to use to display the chartjs graph.&lt;/p&gt;

&lt;p&gt;And daily-increase.component.ts to call service, populate data and generate graph.&lt;/p&gt;

&lt;p&gt;Repeat the similar processes for other graph components. For reference you can clone the full source code from GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2 — Configure serverless and deploy to AWS
&lt;/h2&gt;

&lt;p&gt;First we need to setup an AWS account and obtain the programmatic access. After you have obtained the Access_Key &amp;amp; Access_Secret, keep them somewhere safe and you will need them for lambda deployment. You can find it in IAM -&amp;gt; Users -&amp;gt; Security Credentials -&amp;gt; Create access key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XOb9Soc9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A5tF18Q0v2hlupaLIpChW5Q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XOb9Soc9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A5tF18Q0v2hlupaLIpChW5Q.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then go back to your app and install the serverless package and configure it with your AWS access_key and access_secret.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install serverless
npm install -g serverless

# configure serverless with aws credentials
serverless config credentials --provider aws --key &amp;lt;ACCESS_KEY&amp;gt; --secret &amp;lt;ACCESS_SECRET&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Add @ng-toolkit/universal that allow our app to support server-side rendering,&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng add @ng-toolkit/universal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And add aws as provider,&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng add @ng-toolkit/serverless --provider aws
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;A few other packages may required,&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#package and create your lambda application using Express framework
npm i --save express

npm i --save aws-serverless-express

#Serverless plugin that enables/disables content compression setting in API Gateway
npm i --save-dev serverless-api-compression
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Finally, deploy with this command.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build:serverless:deploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After the deployment completed, you should see an endpoint and function name, and try to open the url from your browser, you should be able to see your web app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--skAlHS7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AhFxkqDgYfmywvo4UiL--gQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--skAlHS7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AhFxkqDgYfmywvo4UiL--gQ.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See it from the AWS Lambda interface&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YvvI9lrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3250/1%2ATiwWkZKkXt41PEPgpfA5Ag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YvvI9lrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3250/1%2ATiwWkZKkXt41PEPgpfA5Ag.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3. Configure dns and domain
&lt;/h2&gt;

&lt;p&gt;You should also see production-angular-app from API Gateway as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Register a domain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am using &lt;a href="https://www.cloudns.net/aff/id/36613/"&gt;CloudNS&lt;/a&gt; to register my domain and configure my dns records there. They provide free dns hosting for one dns zone. Set your NS records to:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ns1.cloudns.net
ns2.cloudns.net
ns3.cloudns.net
ns4.cloudns.net
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Create SSL certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because AWS API Gateway only services content from https, so we need to create a ssl certificate for our web app to be served. And you can request a public ssl certificate from AWS Certificate manager for free.&lt;/p&gt;

&lt;p&gt;Either you can go to certificate manager web page and request a certificate&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BWzZNay4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AaBOZkfBfjBjxP105gLmiyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BWzZNay4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AaBOZkfBfjBjxP105gLmiyw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or using AWS cli to request, it will generate a CName validation pair that you need to put into your domain register.&lt;/p&gt;

&lt;p&gt;To validate you own this domain, you need to obtain the validation CNAME and Value from above, and create a CNAME record in your domain register, this case &lt;a href="https://www.cloudns.net/aff/id/36613/"&gt;CloudNS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lIAG90q1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2298/1%2AcFcKZboJyhhBaz228gL0gQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lIAG90q1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2298/1%2AcFcKZboJyhhBaz228gL0gQ.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have done that, you could see the certificate status from Certificate Manager web page, or use this command by AWS cli&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws acm certificate-validated --certificate-arn &amp;lt;Certificate-CRN&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Create custom domain in API Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can go to API Gateway -&amp;gt; Custom Domain Names -&amp;gt; Create,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l-4u_jz5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2300/1%2AtzCz-24DeistA6vdtPGS4Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l-4u_jz5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2300/1%2AtzCz-24DeistA6vdtPGS4Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in my example I am using US-West-2 as my region, and created my ssl certificate in the same region. So I have to select Regional endpoint for my custom domain name. (For Edge-optimized you will need to have ssl created in us-east-1)&lt;/p&gt;

&lt;p&gt;After created the domain name, you need to select the API mapping, to choose the target API and Stage (we only have production, if you have a staging environment, you can also bind a sub-domain to the staging site)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QAACdXcO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3084/1%2AJNa-P7F9I7O06f03UytH6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QAACdXcO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3084/1%2AJNa-P7F9I7O06f03UytH6w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can use the following AWS cli commands to achieve the same goal, &lt;em&gt;&lt;/em&gt; is your domain name, &lt;em&gt;$CERTIFICATE_ARN&lt;/em&gt; is a variable from above. (you can obtain it from certificate manager as well)&lt;/p&gt;

&lt;p&gt;To know your API Gateway ID, you can see it from API list page,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8W5HjO2f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4064/1%2ACizji2gut0ISAp1jYAQtIA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8W5HjO2f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4064/1%2ACizji2gut0ISAp1jYAQtIA.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, you are all done with your covid-19 dashboard deployed to AWS Lambda and you can access it via API Gateway through your browser.&lt;/p&gt;

&lt;p&gt;Here is the link to GitHub to grab the complete source code for the app.&lt;br&gt;
&lt;a href="https://github.com/superwalnut/covid19-dashboard"&gt;&lt;strong&gt;superwalnut/covid19-dashboard&lt;/strong&gt;&lt;br&gt;
*I have created a COVID-19 dashboard using Angular 9 and demostrate how to deploy it to AWS Lambda using serverless…*github.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
