<?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: Matt Dyor</title>
    <description>The latest articles on DEV Community by Matt Dyor (@mattdyor).</description>
    <link>https://dev.to/mattdyor</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%2F353986%2Fe75d20ab-5203-4492-8e3c-682dd3ca8c26.jpg</url>
      <title>DEV Community: Matt Dyor</title>
      <link>https://dev.to/mattdyor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mattdyor"/>
    <language>en</language>
    <item>
      <title>Prisma Scratch Pad</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sun, 10 Apr 2022 14:37:27 +0000</pubDate>
      <link>https://dev.to/mattdyor/prisma-scratch-pad-7gp</link>
      <guid>https://dev.to/mattdyor/prisma-scratch-pad-7gp</guid>
      <description>&lt;ul&gt;
&lt;li&gt;npx prisma db push&lt;/li&gt;
&lt;li&gt;npx prisma studio&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Things I Learned About Python this Week</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sat, 27 Nov 2021 03:02:38 +0000</pubDate>
      <link>https://dev.to/mattdyor/things-i-learned-about-python-this-week-24l9</link>
      <guid>https://dev.to/mattdyor/things-i-learned-about-python-this-week-24l9</guid>
      <description>&lt;p&gt;&lt;br&gt;
&lt;code&gt;python manage.py shell&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;this gets you into an interactive shell&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from basic_loans.models import BasicLoan DOES NOT WORK
from dyor_com_app.basic_loans.models import BasicLoanPage
b=BasicLoanPage
from dyor_com_app.base.models import People
p = People
p.first="matt"
p.last="dyor"
bl1 = BasicLoan.objects.filter(id=1).first()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which is the same as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bl1 = BasicLoan.objects.get(id=1)
bl1.loan_amount
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create a record&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BL = BasicLoan()
BL.loan_amount
BL.original = bl1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;import datetime&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BL.loan_start_date = datetime.date(2021, 11, 25)
BL.save()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create an object with inline properties&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;page = Page.objects.create(title='my title', summary='my summary')
page.__dict__
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Django on Windows - First Week</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sat, 14 Aug 2021 06:06:44 +0000</pubDate>
      <link>https://dev.to/mattdyor/django-on-windows-first-week-4jmd</link>
      <guid>https://dev.to/mattdyor/django-on-windows-first-week-4jmd</guid>
      <description>&lt;p&gt;I am basing this work on Django for Beginners, but as that book is focused on Linux/Mac I have kept these notes for what I needed to do on my PC. I will keep extending this over the week of Aug 13 (yes, Friday the 13th).  &lt;/p&gt;

&lt;h1&gt;
  
  
  Get Django set up in Virtual Environment
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://codesource.io/setting-up-a-virtual-environment-for-your-django-project/"&gt;https://codesource.io/setting-up-a-virtual-environment-for-your-django-project/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/35950740/virtualenv-is-not-recognized-as-an-internal-or-external-command-operable-prog"&gt;https://stackoverflow.com/questions/35950740/virtualenv-is-not-recognized-as-an-internal-or-external-command-operable-prog&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pip install virtualenv&lt;/li&gt;
&lt;li&gt;I had to open an administrator cmd prompt and do &lt;/li&gt;
&lt;li&gt;c:\python39\python.exe -m pip install --upgrade pip&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  For each project you need to create virtualenv and add django
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;cd into the directory where you want to create python (e.g., C:\Users\madyor\OneDrive - Microsoft\Desktop\python\django\playground) &lt;/li&gt;
&lt;li&gt;python -m virtualenv .&lt;/li&gt;
&lt;li&gt;.\scripts\activate&lt;/li&gt;
&lt;li&gt;pip install django&lt;/li&gt;
&lt;li&gt;pip install pandas&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;django-admin startproject&lt;/code&gt; to verify that django is installed. &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Create Your Project
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;django-admin startproject config .
Note: the . at the end places the project in the current directory (instead of creating a new child with that name) &lt;/li&gt;
&lt;li&gt;python manage.py migrate&lt;/li&gt;
&lt;li&gt;python manage.py runserver
If this command fails, you may need to do the .\scripts\activate to get into the virtual environment (where django is installed)&lt;/li&gt;
&lt;li&gt;exit gets you out of a virtualenv&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Create another app in your project
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;python manage.py startapp pages&lt;/li&gt;
&lt;li&gt;Register the app in config/settings (under installed_apps add &lt;code&gt;'pages',&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;update the views page with the following code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView
from .models import Page
from django.views.generic import TemplateView

from django.shortcuts import render

class PageListView(ListView): 
    model=Page
    template_name = 'home.html'

class PageDetailView(DetailView): 
    model=Page
    template_name = 'page_detail.html'

class PageCreateView(CreateView): 
    model = Page
    template_name = 'page_new.html'
    fields=['title', 'summary', 'description']

class PageUpdateView(UpdateView): 
    model = Page
    template_name = 'page_new.html'
    fields=['title', 'summary', 'description']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;create a urls.py within the pages folder
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.urls import path
from .views import PageDetailView, PageListView, PageCreateView, PageUpdateView

urlpatterns = [
    path('page/new/', PageCreateView.as_view(), name='page_new'), 
    path('page/&amp;lt;int:pk&amp;gt;/', PageDetailView.as_view(), name='page_detail'), 
    path('page/&amp;lt;int:pk&amp;gt;/edit', PageUpdateView.as_view(), name='page_update'), 
    path('', PageListView.as_view(), name='home'),
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;update the config/urls.py to reference the pages.urls (&lt;code&gt;path('', include('pages.urls')),&lt;/code&gt; and add &lt;code&gt;from django.urls.conf import include&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Initiate Git
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;git init&lt;/li&gt;
&lt;li&gt;git status&lt;/li&gt;
&lt;li&gt;git Add -A&lt;/li&gt;
&lt;li&gt;git commit -m "initial commit"&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Create a Repo on Github
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;git remote add origin &lt;a href="https://github.com/dyor/special-octo-journey.git"&gt;https://github.com/dyor/special-octo-journey.git&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;git branch -M main&lt;/li&gt;
&lt;li&gt;git push -u origin main&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Day 2
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Using Templates
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Templates are like views in MVC (and views are like controllers)&lt;/li&gt;
&lt;li&gt;In the config/settings.py, update DIRS to this: 
&lt;code&gt;'DIRS': [str(BASE_DIR.joinpath('templates'))],&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Day 3
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Use a base template
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the pages app, create a &lt;code&gt;templates&lt;/code&gt; folder and add a &lt;code&gt;home.html&lt;/code&gt; and a &lt;code&gt;base.html&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;for &lt;code&gt;base.html&lt;/code&gt; add some code&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href={% url 'home' %}&amp;gt;Home&amp;lt;/a&amp;gt; 
{% block content %}
{% endblock content %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;in the &lt;code&gt;home.html&lt;/code&gt; file add
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% extends 'base.html' %}
{% block content %}
&amp;lt;h1&amp;gt;Homepage&amp;lt;/h1&amp;gt;

{% for page in object_list %}
    &amp;lt;div&amp;gt;
    &amp;lt;a href="{% url  'page_detail' page.pk %}"&amp;gt;{{ page.title }}&amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;
{% endfor %}

{% endblock %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a detail page in &lt;code&gt;templates&lt;/code&gt; folder called &lt;code&gt;page_detail.html&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% extends 'base.html' %}

{% block content %}

&amp;lt;h1&amp;gt;{{ page.title }}&amp;lt;/h1&amp;gt;
{{ page.summary }}
&amp;lt;br/&amp;gt;
&amp;lt;br/&amp;gt;
{{ page.description }}

{% endblock %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;add model to &lt;code&gt;admin.py&lt;/code&gt; in &lt;code&gt;admin&lt;/code&gt; page
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.contrib import admin
from .models import Page

# Register your models here.
admin.site.register(Page)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Random Commands
&lt;/h2&gt;

&lt;p&gt;python manage.py createsuperuser&lt;br&gt;
python manage.py makemigrations&lt;br&gt;
python manage.py migrate&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sending Email from Azure</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Fri, 01 Jan 2021 09:11:42 +0000</pubDate>
      <link>https://dev.to/mattdyor/sending-email-from-azure-aid</link>
      <guid>https://dev.to/mattdyor/sending-email-from-azure-aid</guid>
      <description>&lt;p&gt;First, I tried creating an account directly from Azure and that did not work for me due to a billing issue. &lt;/p&gt;

&lt;p&gt;So I ended up first setting an account up with Sendgrid (a free account with up to 25K emails per month...way more than I will need for now). I started by checking out the integration guide - C# for me: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://app.sendgrid.com/guide/integrate/langs/csharp"&gt;https://app.sendgrid.com/guide/integrate/langs/csharp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first step there was adding SendGrid Nuget Package&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3suBuvn6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wkvk7t20mz6q3nc4x07l.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3suBuvn6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wkvk7t20mz6q3nc4x07l.PNG" alt="Install SendGrid Nuget package"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Adding Custom Domain to Azure App Service</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Thu, 31 Dec 2020 18:16:14 +0000</pubDate>
      <link>https://dev.to/mattdyor/adding-custom-domain-to-azure-app-service-422j</link>
      <guid>https://dev.to/mattdyor/adding-custom-domain-to-azure-app-service-422j</guid>
      <description>&lt;ul&gt;
&lt;li&gt;In App Service, ensure that your App Service Plan is set to a level that supports Custom Domains (e.g., Production S1, runs about $45/month)
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xPYZFG4X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1qsy5x4fpbi3pj1cve3u.PNG" alt="Choose App Service Plan that supports Custom Domains"&gt;
&lt;/li&gt;
&lt;li&gt;In App Service, click on Custom Domains and then Add Custom Domain
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pN2cvKN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qwva39a0gpd8uign7iyb.png" alt="Add Custom Domain"&gt;
&lt;/li&gt;
&lt;li&gt;There are some steps you need to follow to verify that you own the domain name. &lt;/li&gt;
&lt;li&gt;NOTE: in Godaddy, if you are having a hard time validating ownership, add more TXT and CNAMEs - some combination of the following worked for me: 
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q0HQidsK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qgdvs0lcx7y4fucjqls9.PNG" alt="Godaddy DNS Settings for Azure Custom Domains"&gt;
&lt;/li&gt;
&lt;li&gt;Once your custom domain is validated, you need to add SSL - YOU DO NOT NEED TO PAY FOR ONE. Just click on Binding and follow the instructions for creating a SNI SSL Binding. &lt;/li&gt;
&lt;li&gt;Finally, you can add a A record to your DNS in Godaddy that points to your Azure App Service IP address (found on the Custom Domains blade). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fairly basic, but the documentation between the two sites never seems to be very clear, and I always end up spending more time on this than I should have to. I will add some more details the next time I do this (I captured these from memory after spending a couple of hours over the last few days trying to figure out why it was not working properly). &lt;/p&gt;

</description>
      <category>azure</category>
      <category>godaddy</category>
      <category>customdomain</category>
    </item>
    <item>
      <title>Adding a Favicon to an Azure Website</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Fri, 25 Dec 2020 03:23:43 +0000</pubDate>
      <link>https://dev.to/mattdyor/adding-a-favicon-to-an-azure-website-2dc5</link>
      <guid>https://dev.to/mattdyor/adding-a-favicon-to-an-azure-website-2dc5</guid>
      <description>&lt;p&gt;First, you need to generate a favicon.ico file. Fortunately, the team (person) at &lt;a href="https://favicon.io/favicon-generator/"&gt;Favicon.io&lt;/a&gt; have made this very easy and enjoyable. &lt;/p&gt;

&lt;p&gt;Next, replace the favicon.ico in the wwwroot folder of your application with the newly created favicon.ico.&lt;/p&gt;

&lt;p&gt;Note that I did not add this link to my _Layout file:  - and when I did it stopped working. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building an ASP.NET Core Web App from Scratch</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sun, 22 Nov 2020 23:41:36 +0000</pubDate>
      <link>https://dev.to/mattdyor/building-an-asp-net-core-web-app-from-scratch-3okd</link>
      <guid>https://dev.to/mattdyor/building-an-asp-net-core-web-app-from-scratch-3okd</guid>
      <description>&lt;h1&gt;
  
  
  Get Started
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/OdeToCode/OdeToFood"&gt;https://github.com/OdeToCode/OdeToFood&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Start with an asp.net core web application in visual studio&lt;/li&gt;
&lt;li&gt;Select web application (not web application mvc) with defaults&lt;/li&gt;
&lt;li&gt;Add a asp-page to _Layout pointing to Restaurats/list&lt;/li&gt;
&lt;li&gt;Create a folder for Restaurants&lt;/li&gt;
&lt;li&gt;Add a Razor Page (empty) called List in the Restaurants folder&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Adding a property to List
&lt;/h1&gt;

&lt;p&gt;(think of this as model in MVC)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inside the class, type prop TAB TAB string TAB TAB Message that will leave you with &lt;code&gt;public string Message { get; set; }&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In appsettings.config add a "Message": "hello world" &lt;/li&gt;
&lt;li&gt;Back in List type ctor TAB TAB (this will add a constructor)&lt;/li&gt;
&lt;li&gt;Add IConfiguration to () and hit CTRL + . then enter and call the variable config (looks like &lt;code&gt;public ListModel(IConfiguration config)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;hit CTRL + . on config and select "create and assign field config" &lt;/li&gt;
&lt;li&gt;in the OnGet() method add &lt;code&gt;Message = config["Message"];&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Options
&lt;/h1&gt;

&lt;p&gt;If you want to be able to refresh your browser while debugging in asp.net core, you need to add this nuget package: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/54106058/why-does-page-not-update-after-refresh-when-cshtml-changes"&gt;https://stackoverflow.com/questions/54106058/why-does-page-not-update-after-refresh-when-cshtml-changes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;need to use the 3.x version if you are using .net core 3.x&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to use code generators, powershell in to project directory: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dotnet tool install --global dotnet-aspnet-codegenerator &lt;/li&gt;
&lt;li&gt;dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design -v 3.1&lt;/li&gt;
&lt;li&gt;dotnet aspnet-codegenerator razorpage -h&lt;/li&gt;
&lt;li&gt;dotnet aspnet-codegenerator razorpage List2 Empty -udl -outDir .\Pages\Restaurants&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add Model
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Right Click Solution and Add Project&lt;/li&gt;
&lt;li&gt;Choose Class Library (.net core)&lt;/li&gt;
&lt;li&gt;Delete the created class and add your own class, call it Restaurant, make it public&lt;/li&gt;
&lt;li&gt;Add a int Id, string Name, and String Location property&lt;/li&gt;
&lt;li&gt;Add an Enum and use CTRL  + . to put it into its own class file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public enum CuisineType
        {
            None, 
            Mexican, 
            Chinese
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a property of type CuisineType&lt;/li&gt;
&lt;li&gt;CTRL+K then CTRL+D to format&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add Data Access
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add another library class&lt;/li&gt;
&lt;li&gt;Delete the class and add an interface&lt;/li&gt;
&lt;li&gt;Add an Interface with a GetAll() method&lt;/li&gt;
&lt;li&gt;Implement a public class based on the interface&lt;/li&gt;
&lt;li&gt;Add a readonly list of restaurants&lt;/li&gt;
&lt;li&gt;You need to add a reference to the Restaurant class project to this project, and then add a using statement so that the restaurants is available in the data class&lt;/li&gt;
&lt;li&gt;Create a constructor that populates the list of restaurants&lt;/li&gt;
&lt;li&gt;Implement GetAll method - need to add a reference to System.Linq to get the orderby to work&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add Singleton of the data access to startup
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add this to the startup page &lt;code&gt;services.AddSingleton&amp;lt;IRestaurantData, InMemoryRestaurantData&amp;gt;();&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add Data to List
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add the IRestaurantData interface to the data list constructor&lt;/li&gt;
&lt;li&gt;CTRL + . on IRestaurantData and add "create and assign field config" - should look something like this &lt;code&gt;public ListModel(IConfiguration config, IRestaurantData restaurantData)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add Search
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add a form with method=get and no action (will point to itself). &lt;/li&gt;
&lt;li&gt;Include a input type=search name=searchTerm&lt;/li&gt;
&lt;li&gt;include an i tag with a class="fa-search" &lt;/li&gt;
&lt;li&gt;To get font awesome to work, you need to get a fontawesome.io url and add it to your URL; if you want autocomplete you need to right click on the project name &amp;gt; add &amp;gt; client side library &amp;gt; provider=unpkg, search for font awesome.  Code is like &lt;code&gt;&amp;lt;i class="fas fa-search"&amp;gt;&amp;lt;/i&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Replace the GetAll on the restaurants interface with a GetRestaurantByName&lt;/li&gt;
&lt;li&gt;In the implementation method, specify that the name is a string name=null, meaning that if not provided no filtering. &lt;/li&gt;
&lt;li&gt;Update the linq query to include a &lt;code&gt;where string.IsNullOrEmpty(name) || r.Name.StartsWith(name)&lt;/code&gt; that includes all if no filter (remember this filter is currently case sensitive)&lt;/li&gt;
&lt;li&gt;Change the OnGet method of List code behind to include &lt;code&gt;Restaurants = restaurantData.GetRestaurantsByName(searchTerm);&lt;/code&gt; here the searchTerm is pulled from the Request based on the name of the input field&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Show Searched For Term
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Instead of pulling the searchTerm from the request, specify a property with a capital S SearchTerm and a BindProperty that means it will Bind when the request is received
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[BindProperty(SupportsGet =true)]
public string SearchTerm { get; set; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace name and value on input form to asp-for="SearchTerm" &lt;code&gt;&amp;lt;input type="search" class="form-control" asp-for="SearchTerm" /&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Make a Details Page
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Right Click Restaurants folder, Add, Razor Page (empty)&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;public Restaurant Restaurant { get; set; }&lt;/code&gt; to the PageModel&lt;/li&gt;
&lt;li&gt;On the cshtml, you can now use &lt;code&gt;@Model.Restaurant.Name&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;You can make embed the restaurantId in the url with &lt;code&gt;page "{restaurantId:int}"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Make an Edit Page
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Largely the same as Details, but sometimes you need to use @Model and sometimes not
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form method="post"&amp;gt;
    &amp;lt;input type="hidden" asp-for="@Model.Restaurant.Id" /&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
        &amp;lt;label asp-for="@Model.Restaurant.Name"&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;input asp-for="@Model.Restaurant.Name" class="form-control" /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
        &amp;lt;label asp-for="@Model.Restaurant.Location"&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;input asp-for="@Model.Restaurant.Location" class="form-control" /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
        &amp;lt;label asp-for="@Model.Restaurant.Name"&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;select class="form-control" asp-for="Restaurant.Cuisine" asp-items="Model.Cuisines" &amp;gt;
        &amp;lt;/select&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In the PageModel, you need to pull in the IHTMLHelper
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class EditModel : PageModel
    {
        private readonly IRestaurantData restaurantData;
        private readonly IHtmlHelper htmlHelper;

        public  Restaurant Restaurant { get; set; }
        public IEnumerable&amp;lt;SelectListItem&amp;gt; Cuisines { get; set; }
        public EditModel(IRestaurantData restaurantData, IHtmlHelper htmlHelper)
        {
            this.restaurantData = restaurantData;
            this.htmlHelper = htmlHelper;
        }
        public IActionResult OnGet(int restaurantId)
        {
            Cuisines = htmlHelper.GetEnumSelectList&amp;lt;CuisineType&amp;gt;(); 
            Restaurant = restaurantData.GetById(restaurantId); 
            if (Restaurant == null)
            {
                RedirectToPage("./NotFound");
            }
            return Page(); 
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Connect to Local SQL
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add a connection string to localdb
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"ConnectionStrings": {
    "OdeToFoodDb":  "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=OdeToFood;Integrated Security=True;"
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Wire up the app settings via configure services using an options lambda expression:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            services.AddDbContextPool&amp;lt;OdeToFoodDbContext&amp;gt;(options =&amp;gt; {
                options.UseSqlServer(Configuration.GetConnectionString("OdeToFoodDb")); 
            }); 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a constructor to the DbContext that pulls in the options from the app settings:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public OdeToFoodDbContext(DbContextOptions&amp;lt;OdeToFoodDbContext&amp;gt; options) : base(options)
        {
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally need to tell the .Data project to look at the base project for the options information &lt;code&gt;dotnet ef dbcontext info -s ..\OdeToFood\OdeToFood.csproj&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Add a Migration
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;in the CLI run &lt;code&gt;dotnet ef migrations add initialcreate -s ..\OdeToFood\OdeToFood.csproj&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;then apply the migration &lt;code&gt;dotnet ef database update -s ..\OdeToFood\OdeToFood.csproj&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Implement Delete Functionality
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Add a Delete function &lt;code&gt;Restaurant Delete(int id);&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;CTRL+. on the InMemoryRestaurantData and select option to move to its own class file&lt;/li&gt;
&lt;li&gt;in the new file, CTRL+. and select to implement interface (this will add the delete) &lt;/li&gt;
&lt;li&gt;Add the delete code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       {
            var restaurant = restaurants.FirstOrDefault(r =&amp;gt; r.Id == id); 
            if (restaurant != null)
            {
                restaurants.Remove(restaurant); 
            }
            return restaurant; 
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Add the SQL
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;on the IRestaurantData file, type this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public class SqlRestaurantData : IRestaurantData
    {

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;CTRL+. and SqlRestaurantData and select option to move to its own file&lt;/li&gt;
&lt;li&gt;in the new file, CTRL+. implement the interface&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Connecting Power BI to PostgreSQL on Azure</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Wed, 22 Apr 2020 20:21:45 +0000</pubDate>
      <link>https://dev.to/mattdyor/connecting-power-bi-to-postgresql-on-azure-22ie</link>
      <guid>https://dev.to/mattdyor/connecting-power-bi-to-postgresql-on-azure-22ie</guid>
      <description>&lt;p&gt;If you want to connect your desktop Power BI to a SQL Server on Azure, it is a pretty simple couple of clicks. PostgreSQL takes a couple of additional options. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your Windows machine, click on Windows &amp;gt; ODBC Data Sources (32 Bit)&lt;/li&gt;
&lt;li&gt;Click on the Drivers tab to make sure you have the PostgreSQL ODBC Driver&lt;/li&gt;
&lt;li&gt;Click on the User DNS tab and Add a connection to the PostgreSQL ODBC Driver (I used the Unicode driver, but I am not sure if that is required)&lt;/li&gt;
&lt;li&gt;In Power BI, click on Get Data (the top of the icon, not the drop down - if you click the drop down you need to select More...) &lt;/li&gt;
&lt;li&gt;Search for ODBC&lt;/li&gt;
&lt;li&gt;You should see the Data Source Name you just created as an option. I don't think you need to specify Advanced Options, as the DNS has all of this information. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You are now ready to pull data into Power BI from your Azure-hosted PostreSQL database (and this would probably work on platforms other than Azure as well, but I have not tested them out). &lt;/p&gt;

&lt;p&gt;Cheers. &lt;/p&gt;

&lt;p&gt;Matt&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Migrating a Node App to Docker</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Mon, 30 Mar 2020 04:14:33 +0000</pubDate>
      <link>https://dev.to/mattdyor/migrating-a-node-app-to-docker-k5b</link>
      <guid>https://dev.to/mattdyor/migrating-a-node-app-to-docker-k5b</guid>
      <description>&lt;p&gt;Good article describing &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;a href="https://nodejs.org/fr/docs/guides/nodejs-docker-webapp/"&gt;Migrating a Node App to Docker&lt;/a&gt;
&lt;/h1&gt;

</description>
      <category>node</category>
      <category>docker</category>
      <category>reminder</category>
    </item>
    <item>
      <title>Pushing an Existing Node App to Azure</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sat, 28 Mar 2020 02:54:19 +0000</pubDate>
      <link>https://dev.to/mattdyor/pushing-an-existing-node-app-to-azure-5hhg</link>
      <guid>https://dev.to/mattdyor/pushing-an-existing-node-app-to-azure-5hhg</guid>
      <description>&lt;p&gt;If you have code that is working on your local machine, and you want to deploy it to Azure, and you have a DevOps account configured, here is how. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you were previously deploying somewhere else (like Heroku), delete the .git directory (there is probably a more elegant way to reset git, but delete works)&lt;/li&gt;
&lt;li&gt;Configure git in the directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m "initial commit"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In Azure DevOps, create a new project&lt;/li&gt;
&lt;li&gt;Navigate to Repos. You will see an option to push an existing repository from command line. Grab that code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin https://teamsi@dev.azure.com/teamsi/PilotDataEngine/_git/PilotDataEngine
git push -u origin --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;in the &lt;a href="https://portal.azure.com"&gt;Azure Portal&lt;/a&gt;, you want to create a "Web App + PostgreSQL" instead of creating the web app and database separately, and having to stitch the networking and permissions and port configurations together. This is goofily hard to find, so try

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://portal.azure.com/#create/hub"&gt;Create a resource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Search for "Web App + PostgreSQL"&lt;/li&gt;
&lt;li&gt;It may be directly linkable &lt;a href="https://portal.azure.com/#create/Microsoft.WebSitePGSQLDatabase"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;I tried using pipelines, but that was not successful, so I just used the VS Code Azure Extension to deploy directly (&lt;a href="https://docs.microsoft.com/en-us/azure/javascript/tutorial-vscode-azure-app-service-node-01?tabs=bash"&gt;explained here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Visit the Overview tab in the Azure portal, click on the URL, and your app should be alive. &lt;/li&gt;
&lt;li&gt;If you use Sequelize, adjust your local database settings to point to the Azur PostgreSQL server, and run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequelize db:migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Figure out how to fire off sequelize from Azure (instead of having to update from the local application)&lt;/li&gt;
&lt;li&gt;Figure out how to use Azure Pipelines. I was able to get the Azure Pipelines set up to run upon code upload, but something was not working. If anybody has a blog post talking about configuring Azure pipelines for node (that is current), please share it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks. &lt;/p&gt;

&lt;p&gt;Matt&lt;/p&gt;

</description>
      <category>azure</category>
      <category>node</category>
      <category>devops</category>
    </item>
    <item>
      <title>Testing Out MongoDB + Express + React + Node + Sendgrid + Heroku</title>
      <dc:creator>Matt Dyor</dc:creator>
      <pubDate>Sun, 22 Mar 2020 18:34:52 +0000</pubDate>
      <link>https://dev.to/mattdyor/testing-out-couchbase-express-react-node-sendgrid-heroku-2fn8</link>
      <guid>https://dev.to/mattdyor/testing-out-couchbase-express-react-node-sendgrid-heroku-2fn8</guid>
      <description>&lt;p&gt;This post will capture how I got started building a simple web application to capture feedback about a piece of content - anything from an icon design to a business plan to a job posting. Here are the basic requirements: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a feedback "record" (called a document in Couchbase, but it is just data in JSON form)&lt;/li&gt;
&lt;li&gt;upload a piece of content (that is actually a document, such as a PNG, PPT, DOC, etc.) by web or by email&lt;/li&gt;
&lt;li&gt;email all users specified in the feedback record with a copy of the document, asking them for feedback&lt;/li&gt;
&lt;li&gt;real-time chat between users that updates without a page refresh&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Build the basic data model
&lt;/h1&gt;

&lt;p&gt;Although NoSQL databases like Couchbase allow you to worry less about the data model, starting with a clear definition of how you are thinking about your data is a smart first step. &lt;/p&gt;

&lt;p&gt;Check out this video for the difference between data modeling in RDBMS v. data modeling in Couchbase: &lt;a href="https://youtu.be/Mj4PKKidREU"&gt;Data Modeling in Couchbase&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a first cut of the Couchbase data model for a document, which is the core object in the system - the thing that we want to get feedback on:&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="p"&gt;{&lt;/span&gt;
   &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;document&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;integer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;createdDate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;datetime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;updatedDate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;datetime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;reviewers&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rating&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;int&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rating&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;int&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;comments&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  SQL v. NoSQL
&lt;/h2&gt;

&lt;p&gt;SQL: you need to invest heavily in your database design, because you immediately create a lot of scaffolding around the design - in the database, in the backend, and in the frontend. Simple changes to the data model require massive amounts of changes in your code base. &lt;br&gt;
NoSQL: you get to start with a simplified data model much quicker, and then you can evolve the data model over time. For example, instead of creating a user table, a comments table, and a documents table, and then associating the user table to the documents table through a many-to-many bridge table, etc., you can just start with the data structure above to get started. There are key scenarios that will need to be addressed down the road, such as what happens if a person updates their email address - how do you update all of the places where that email address exists. But why not solve those problems later, and focus on your most important problem up front: &lt;strong&gt;can we find a pain worth solving that we can address with software we can build&lt;/strong&gt;. &lt;/p&gt;
&lt;h1&gt;
  
  
  Get Running on Heroku
&lt;/h1&gt;

&lt;p&gt;This assumes that you have &lt;a href="https://code.visualstudio.com/download"&gt;Visual Studio Code&lt;/a&gt; running on your machine. &lt;/p&gt;

&lt;p&gt;A great reference for getting started on Heroku is provided by Heroku itself: &lt;a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs"&gt;Getting Started with NodeJS&lt;/a&gt;. It comes down to: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up"&gt;Install Heroku Client&lt;/a&gt; - this page also shows you how to check if you have Node, npm, and git installed. &lt;/li&gt;
&lt;li&gt;Create your own Node Express app: this is NOT part of the Heroku tutorial, but instead of just copying their app we are going to write our own using another tutorial: &lt;a href="https://youtu.be/CsWoMpK3EtE?t=76"&gt;NodeJS API Tutorial&lt;/a&gt; - just watch to minute 4 (unless you want to learn about Docker). key steps: 

&lt;ul&gt;
&lt;li&gt;create a folder called...heroku&lt;/li&gt;
&lt;li&gt;open the folder in Code&lt;/li&gt;
&lt;li&gt;create a file in Code called app.js&lt;/li&gt;
&lt;li&gt;paste in this code
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&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="s1"&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="s1"&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="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="s1"&gt;I am alive!&lt;/span&gt;&lt;span class="dl"&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;3000&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="s1"&gt;I am alive on port 3000!&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;ul&gt;
&lt;li&gt;Create your own Node app (cont)

&lt;ul&gt;
&lt;li&gt;in code, hit Terminal &amp;gt; New Terminal &lt;/li&gt;
&lt;li&gt;in the Terminal, type
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create your own Node app (cont)

&lt;ul&gt;
&lt;li&gt;accept all the defaults&lt;/li&gt;
&lt;li&gt;Open the pakcage.json file that was created with the last command&lt;/li&gt;
&lt;li&gt;back in Terminal, type
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save express
npm install --save nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create your own Node app (cont)

&lt;ul&gt;
&lt;li&gt;you should see express appear as a dependency in package.json. &lt;/li&gt;
&lt;li&gt;in the package.json file, inside the scripts element, add a start instruction
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nodemon app.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&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;ul&gt;
&lt;li&gt;Create your own Node app (cont)

&lt;ul&gt;
&lt;li&gt;to start the application, in the terminal type
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create your own Node app (cont)

&lt;ul&gt;
&lt;li&gt;head on over to &lt;a href="http://localhost:3000"&gt;localhost:3000&lt;/a&gt; and you should see your shiny new app. Whenever a change is made, nodemon will pick it up and republish your app. Try it. &lt;/li&gt;
&lt;li&gt;when you are done testing your app, type CTRL+C in the Terminal to terminate the job. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now that you have created your node app, you can configure the app for Git.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;and then you can publish it via the Terminal with
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku create
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;This will create a home for your application on Heroku and create the git connection between your machine and the Heroku git repository.
&lt;/li&gt;
&lt;li&gt;Now you are ready for my favorite haiku:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "my first commit"
git push heroku master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;There should be a funny name for your application, such as &lt;a href="https://shrouded-atoll-61606.herokuapp.com/"&gt;https://shrouded-atoll-61606.herokuapp.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Get Mongo running
&lt;/h1&gt;

&lt;p&gt;First, &lt;a href="https://www.mongodb.com/dr/fastdl.mongodb.org/win32/mongodb-win32-x86_64-2012plus-4.2.3-signed.msi/download"&gt;install Mongo on your local machine&lt;/a&gt;. Then get the node mongo driver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save mongodb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this to your app.js file&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;MongoClient&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="s1"&gt;mongodb&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;MongoClient&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;uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mongodb+srv://&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;@&amp;lt;your-cluster-url&amp;gt;/test?retryWrites=true&amp;amp;w=majority&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;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;MongoClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;useNewUrlParser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;collection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;devices&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// perform actions on the collection object&lt;/span&gt;
  &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;close&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;Now that you have everything working locally, you need to configure it for Heroku. mLab has a free sandbox option for running MongoDB, so we will use that. Go to your Heroku dashboard, find your application, click "Configure Add Ons" and search for mLab MongoDB. Add the free version. &lt;/p&gt;

&lt;p&gt;More to come soon!&lt;/p&gt;

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