<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kyle Trusler on Medium]]></title>
        <description><![CDATA[Stories by Kyle Trusler on Medium]]></description>
        <link>https://medium.com/@SvenDevelops?source=rss-d29c47066366------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FKhJu7VdXxR4b17y</url>
            <title>Stories by Kyle Trusler on Medium</title>
            <link>https://medium.com/@SvenDevelops?source=rss-d29c47066366------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:22:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SvenDevelops/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Testing the intelligent, buggy Ant Design Landing Editor]]></title>
            <link>https://medium.com/camerakit/testing-the-intelligent-buggy-ant-design-landing-editor-78282ae25605?source=rss-d29c47066366------2</link>
            <guid isPermaLink="false">https://medium.com/p/78282ae25605</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[wysiwyg]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Kyle Trusler]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 21:33:46 GMT</pubDate>
            <atom:updated>2019-01-30T21:33:46.181Z</atom:updated>
            <content:encoded><![CDATA[<p>I like trying new things. From the grocery store cereal aisle to cell phones, the intrinsic value of <strong>“latest and greatest”</strong> wins out in my mental arguments. This mentality then carries over to the software development world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*iX8E09mca1Ei2W8fvQYISg.png" /><figcaption>The choice is clear.</figcaption></figure><p>You know when you go to download software and all the versions show up? <strong>I wave away the warnings about possible problems and boldly select the beta version</strong>. I never know what’s new, but no chance I will be behind. And with web development, <a href="https://yarnpkg.com/en/">yarn package manager</a> dangerously enables me to update everything at once with just one simple command: yarn upgrade --latest.</p><p>To redesign the CameraKit website, we wanted to go towards a component library that easily integrated with <a href="https://nextjs.org/">Next.js</a>. The choices narrowed down to Google’s wonderful <a href="https://material.io/design/">Material Design</a> and the “enterprise-class UI design language and React implementation” of <a href="https://ant.design/">Ant Design</a>. <strong>During that search, I was struck by a “NEW” badge.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*9FWdCg5lQhbuh8maEgO1PA.png" /><figcaption>Seriously it came out of nowhere.</figcaption></figure><p>Alright Ant Design, you win this time. I’ll check it out. Ant Design’s <a href="https://landing.ant.design/">Landing</a> greets you with a great landing page! Other documentation from Ant Design is nicely translated, but since Landing is still in early stages of development the effort of gracious editors haven’t gotten to all of the content yet. There are three other major categories to explore before we get to the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XkaKOkV_SOcLh5_zK_bkfg.png" /><figcaption>They’re all different, but share the same feeling.</figcaption></figure><h4>Templates</h4><p>There are currently eight templates to choose from. These are all well thought out websites that are easy to preview for<strong> both desktop and mobile</strong>. The first two can be edited with the all NEW landing editor! (More on that later.) The other ones are available to download from their respective GitHub repositories. These are ready-to-go react projects with testing and linting. npm i &amp;&amp; npm start is all you need to get up and running.</p><h4>Design Guide</h4><p>The second category is a well laid out <a href="https://landing.ant.design/docs/introduce">documentation page</a> that is unfortunately not translated. The guide seems to lay out the foundation of how the user interacts with, and how a landing page will look. The content in these guides, however, is far from the depth of Material Design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Py7PXaIa9001EyLkHZQ0qg.png" /><figcaption>I’m not sure what this is useful for to be honest.</figcaption></figure><h4>Sketch</h4><p>Here you are able to download a <a href="https://www.sketchapp.com/">Sketch</a> file with all of the components available in the editor.</p><h3>Editor</h3><p>Finally the editor! It’s very similar to other <a href="https://en.wikipedia.org/wiki/WYSIWYG">WYSIWYG</a> editors, but this editor tries to follow all of the Landing guidelines. Here is an overview of what it looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fh7Ftg9oPoALeHOqbrWjKA.png" /><figcaption>Quite the dark theme.</figcaption></figure><h4>What I like</h4><p>The amount of <strong>styling options </strong>is fantastic. Changing the style happens instantly and there are well thought out dropdowns, button groups, and input fields for different properties. The output CSS is shown, but cannot be edited.</p><p>Moving around and <strong>adding templates </strong>is an easy drag-and-drop action with some pre-populated text and images for inspiration. You can choose from all of the components that are used to create the two sample sites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*3sBhWO6AygY7oWpp1SI1ng.png" /></figure><p>Each individual node of the component can be edited and styled to give you very <strong>granular control</strong> of how each part of the site will look.</p><p>You are able to <strong>save, preview, and download</strong> your site as well. When downloaded, the resulting file includes individual .jsx files for each component as well as a corresponding .less file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*OkW_56Q5QqQQ-gsVoAJHRQ.png" /><figcaption>Everything that is downloaded.</figcaption></figure><p>For the astute readers, you have noticed the data.source.js file which is where the components get their data to display. For example, here is the footer data.</p><pre>export const Footer00DataSource = {<br>  wrapper: { className: &#39;home-page-wrapper footer0-wrapper&#39; },<br>  OverPack: { className: &#39;home-page footer0&#39;, playScale: 0.05 },<br>  copyright: {<br>    className: &#39;copyright&#39;,<br>    children: (<br>      &lt;span&gt;©2018 &lt;a href=&quot;https://motion.ant.design&quot;&gt;Ant Motion&lt;/a&gt; All Rights Reserved&lt;/span&gt;),<br>    },<br>  };</pre><p>In the Footer0.jsx file, here is what the React component renders.</p><pre>&lt;div {...props} {...dataSource.wrapper}&gt;<br>  &lt;OverPack {...dataSource.OverPack}&gt;<br>    &lt;TweenOne<br>      animation={{ y: &#39;+=30&#39;, opacity: 0, type: &#39;from&#39; }}<br>      key=&quot;footer&quot;<br>      {...dataSource.copyright}<br>    &gt;<br>    {dataSource.copyright.children}<br>    &lt;/TweenOne&gt;<br>  &lt;/OverPack&gt;<br>&lt;/div&gt;</pre><p>As you can see, the component has no static data inside it, but instead uses everything in the dataSource object to set the className and content. Overall I do not know if this is better or worse, but is <strong>interesting</strong> nonetheless.</p><h4>What I do not like</h4><p>The style customization is nice, but <strong>this isn’t an editor for someone who isn’t already pretty familiar with CSS. </strong>Some of the options do not make sense to be put onto text, and other options do not make sense to put onto images. Settings like border will not appear to be working until you specify the width, color, and style which is confusing at first.</p><p>The amount of components you are able to add is <strong>only</strong> <strong>24</strong>. There are three navs, four banners, fourteen different content containers and three footers. So not much customization there.</p><p>The editor does <strong>not allow any movement or addition of individual components</strong> on the pre-made templates. This leads to websites that are incredibly hard to differentiate from any other created by this editor. Also, when styling these components you can change the padding and margins around which seems to be at odds with the design principles in the first place.</p><h4>What bugs me</h4><p>When I was trying to create a landing page for our site to test out this editor, I spent a good amount of time adding, removing, and rearranging elements to get it just the way I wanted. I did not change any styling because I only wanted the complete layout to start with. There were some <strong>minor inconveniences</strong> along the way, but there was a huge problem.</p><p>After downloading and integrating the code within our existing development site, the output was of a version I previously had been working on. It seemed to not save anything I had done. Now this is clearly my fault — I should have done a better check of the files before blindly copy/pasting. This only wasted about an hour of my time, but <strong>I can’t recommend this for any serious work</strong>. I even tried downloading it again, but the same problem appeared.</p><h4>This is still a work in progress</h4><p>The direction this project is headed looks awesome! I know that eventually this editor will be great, but right now it will just be a very fun tech showcase!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78282ae25605" width="1" height="1" alt=""><hr><p><a href="https://medium.com/camerakit/testing-the-intelligent-buggy-ant-design-landing-editor-78282ae25605">Testing the intelligent, buggy Ant Design Landing Editor</a> was originally published in <a href="https://medium.com/camerakit">CameraKit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a NestJS API — A Peek Through My Search History]]></title>
            <link>https://medium.com/camerakit/building-a-nestjs-api-a-peek-through-my-search-history-80043c6322f0?source=rss-d29c47066366------2</link>
            <guid isPermaLink="false">https://medium.com/p/80043c6322f0</guid>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Kyle Trusler]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 14:31:01 GMT</pubDate>
            <atom:updated>2018-11-07T14:31:01.376Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a NestJS API — A Peek Through My Search History</h3><p>Recently, I was tasked with creating our API. I chose <a href="https://nestjs.com/">NestJS</a> to experiment with since its tagline:</p><blockquote>A progressive Node.js framework for building efficient, reliable and scalable server-side applications.</blockquote><p>really jived with me. I was excited to tackle this problem and thought with my <a href="https://www.javascript.com/">JavaScript</a> background — learning a new library while also learning <a href="https://www.typescriptlang.org/">TypeScript</a> couldn’t be that hard, could it? Well, 500+ searches and a <em>pretty good</em> API foundation later, NestJS has lived up to the excitement. This article takes you through my development hurdles and successes.</p><p><em>A selection of my searches will be displayed in the format: </em><strong><em>search</em></strong>🔎<em> as well as quick answers to some. Additionally, on the search itself, I’ve linked to specific articles or posts that solved those queries.</em></p><h4>API requirements</h4><ul><li>Typescript, TypeORM, GraphQL Support</li><li>Basic Splash Page that shows ‘API Operational’ with CameraKit Logo/etc</li><li>User scheme to support sign-in, sign-up, portal access, and user settings</li></ul><h4>Doing Research</h4><p>It starts with the <strong><em>nestjs</em></strong>🔎 search. One that I had used seven more times over the course of development, most assuredly to get to the main <a href="https://nestjs.com/">NestJS</a> site — a great source of <a href="https://docs.nestjs.com/">documentation and best practices</a>. I quickly realized I needed to take a step back to see <em>what</em> NestJS does. <strong><em>nestjs explanation</em></strong>🔎landed me <a href="https://auth0.com/blog/nestjs-brings-typescript-to-nodejs-and-express/">this great article</a> from <a href="https://auth0.com/">Auth0</a>. The next search <strong><em>nestjs vs nextjs</em></strong>🔎 seems a bit out of place, but to make things a bit more confusing, the main <a href="https://camerakit.io/">CameraKit website</a> began transitioning to <a href="https://nextjs.org/">NextJS</a> for server-side rendered React; which, of course, has nothing in common with NestJS besides <em>very similar </em>pronunciation.</p><h4>Constructing the Scaffold</h4><p>I soon gained a bit of confidence as I started branching off to the beginning steps of making an API— <strong><em>nestjs user authentication</em></strong>🔎 which led me down the path of <strong><em>using nestjs passport</em></strong>🔎, and then getting a bit more serious with the keyword-shotgun approach <strong><em>scaffold nestjs typescript typeorm graphql</em></strong>🔎 — a surprisingly helpful search which pointed me towards <a href="https://github.com/unlight/nest-typescript-starter">this GitHub Repository</a>. I will implement some of the ideas here, just to have them not work later, though, after an update changes the interfaces. I then realized I should include Linting; <strong><em>tslint airbnb rules</em></strong>🔎, <strong><em>tslint config json extend</em></strong>🔎, and <strong><em>tsconfig.json</em></strong>🔎 helped set up <a href="https://www.npmjs.com/package/tslint">TsLint</a> with my preferred <a href="https://www.npmjs.com/package/tslint-config-airbnb">Airbnb Config</a>. This was not any harder than installing and adding a line in tslint.json.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e0e06335f9273e4bf1a5e7b8abe8653/href">https://medium.com/media/8e0e06335f9273e4bf1a5e7b8abe8653/href</a></iframe><h4>Adding a Database</h4><p><a href="https://www.apollographql.com/">Apollo</a> support was next on my todo list:</p><blockquote><em>🔎 <br></em><strong><em>-</em></strong><em> </em><strong>scaffold tests typescript typeorm grapql<br>-<em> </em>apollo server express<br>-<em> </em></strong><a href="https://github.com/nestjs/graphql"><strong>nestjs grapql scaffold</strong></a></blockquote><p>Though I ran into what I thought was a problem with a package version<em> </em><a href="https://github.com/apollographql/apollo-server/issues/927#issuecomment-386383916"><strong><em>Module has no exported member ‘graphiqlexpress’</em></strong></a>🔎. I solved this by adding @types/grpahql. Only after<strong><em> </em></strong><em>some </em>confusion: <strong><em>Removing carrots from dependencies</em>🔎, </strong><a href="https://docs.npmjs.com/files/package.json#dependencies"><strong><em>What are carrots in package.json</em></strong></a><strong>🔎</strong>.</p><p>After adding <a href="http://typeorm.io/">TypeORM</a> (with the help of the <a href="https://docs.nestjs.com/techniques/database">docs</a>), and deciding to use <a href="https://www.postgresql.org/">PostgreSQL</a> as the database, I was ready to start writing some code.</p><blockquote><strong><em>🔎<br>- </em></strong><a href="https://github.com/nestjs/typeorm"><strong>add typeorm to nestjs</strong></a><strong><br>-<em> </em>best db to use with typeorm<br>-<em> </em>what database to use with typeorm<br>- typeorm and mongodb<br>- set up postgresql server on windows</strong></blockquote><h4>Making the Index Page</h4><p>I like starting with a splash page for the API to have a quick and dirty way to confirm requests are being served. This involved getting the file system</p><blockquote><strong><em>🔎<br></em>- </strong><a href="https://github.com/nestjs/nest/issues/402#issuecomment-388663210"><strong>nestjs index example</strong></a><strong><br>- import path</strong><br><strong>-</strong> <strong>favicon</strong></blockquote><p>Including the favicon</p><blockquote><strong><em>🔎<br></em>- favicon</strong><br><strong>-</strong> <strong>favicon include in site</strong><br><strong>-</strong> <strong>Nestjs fastify “favicon”</strong></blockquote><p>As well as getting the image and font right</p><blockquote><strong><em>🔎<br></em>- </strong><a href="https://fonts.google.com/specimen/Roboto"><strong>Roboto text</strong></a><br><strong>-</strong> <a href="https://css-tricks.com/snippets/css/font-shorthand/"><strong>font shorthand</strong></a><strong> </strong><br><strong>-</strong> <a href="https://stackoverflow.com/a/13515693/3072752"><strong>vertically align text in div</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*yRv0QV-ECdg10rHrXq6YyA.png" /><figcaption>“CameraKit API Operational” on the index page</figcaption></figure><h4><a href="https://stackoverflow.com/a/50825704/3072752"><em>“nest can’t resolve dependencies of the”</em></a>🔎</h4><p>This search, and similar phrases, came up multiple times while developing with NestJS. An error might look something like:</p><pre>[ExceptionHandler] Nest can&#39;t resolve dependencies of the UserController (UserService, ?). Please make sure that the argument at index [1] is available in the current context.</pre><p>and I did not know where to look at first. I thought there was something I didn’t know about <strong><em>nestjs interface</em></strong>🔎 or <a href="https://www.typescriptlang.org/docs/handbook/interfaces.html"><strong><em>typescript interface</em></strong></a><strong>🔎, </strong>but there were some helpful clues. First, I looked inside the user.controller, and realized that (UserService, ?) points towards its constructor:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d90e2ba3d18f4ded5c9dd233aacf39f4/href">https://medium.com/media/d90e2ba3d18f4ded5c9dd233aacf39f4/href</a></iframe><p>You can see NestJS knows about the UserService, and even though I believed I imported the SubscriptionService</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7ff32405e0a0c64a63ab5c1f5e2ae2b/href">https://medium.com/media/b7ff32405e0a0c64a63ab5c1f5e2ae2b/href</a></iframe><p><a href="https://docs.nestjs.com/modules"><strong><em>nestjs imports exports providers</em></strong></a>🔎 showed me it both needs to be exported from subscription.module</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc101d0dd81811b8dfe0cd3b09f4586d/href">https://medium.com/media/cc101d0dd81811b8dfe0cd3b09f4586d/href</a></iframe><p>As well as imported from the user.module</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ce3c7562b66d11b085406f61ef38c99/href">https://medium.com/media/0ce3c7562b66d11b085406f61ef38c99/href</a></iframe><h4>Using Different Development Environments</h4><p>Because I develop on a Windows computer and Mac laptop, programs and services outside of the great <a href="https://www.npmjs.com/">NPM</a> need to be installed: <a href="https://www.postgresql.org/download/macosx/"><strong><em>install postgres mac</em></strong></a>🔎, debugged:<em> </em><a href="https://apple.stackexchange.com/a/254381"><strong><em>invalid active developer path</em></strong></a>🔎<strong><em> </em></strong>and set up: <a href="https://support.rackspace.com/how-to/postgresql-creating-and-dropping-roles/"><strong><em>create role postgresql</em></strong></a>🔎<strong><em> postgresql mac service cli</em></strong>🔎 <strong><em>default postgres password</em></strong>🔎<strong><em> create user postgres</em></strong>🔎. After getting back up to speed on the Mac side I begin implementing user registration and login.<strong><em> nest authentication login api</em></strong>🔎<strong><em> </em></strong>and <strong><em>nestjs authentication</em></strong>🔎<strong><em> </em></strong>kept pointing me towards <a href="https://github.com/nestjs/passport">nestjs/passport</a> as well as the <a href="https://docs.nestjs.com/techniques/authentication">authentication technique</a> in the NestJS docs. I eventually went with their “best practice”, and decided to follow the <a href="https://jwt.io/">JWT</a> approach.</p><blockquote><em>🔎<br></em><strong>-</strong> <strong>jwt passport persistent sessions<br>- express session<br>- nestjs passport session<br>- passport session<br>- passport jwt session<br>- </strong><a href="https://github.com/nestjs/typescript-starter/issues/37"><strong>debugging nestjs</strong></a><strong><br>- auto attach vs option</strong></blockquote><p>Out of those searches, I realized I did not want to use <a href="https://www.npmjs.com/package/express-session">express session</a> as well as learning how to debug from <a href="https://github.com/nestjs/typescript-starter">here</a>. For <a href="https://github.com/Microsoft/vscode">Visual Studio Code</a> users turn on Auto Attach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*7wdPSC-2S6WXpCMLaGlWDA.png" /><figcaption>Visual Studio Code settings — search for “auto attach” and flip it on</figcaption></figure><p>and create nodemon.jsonwhich runs with <a href="https://nodemon.io/">nodemon</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afc8fbc9452418063bd2f24c97ec506c/href">https://medium.com/media/afc8fbc9452418063bd2f24c97ec506c/href</a></iframe><h4>Adding custom Configuration and Security</h4><p>A <em>few </em>searches later,</p><blockquote><em>🔎</em><strong><br>- what passport strategy to use for logins local vs jwt<br>- </strong><a href="https://www.jbspeakr.cc/purpose-jwt-stateless-authentication/"><strong>what’s the point of jwt</strong></a><strong><br>- saving jwt in local storage<br>- nestjs middleware cookie session login authentication<br>- passport extend strategy<br>- nestjs guard passport<br>- </strong><a href="https://docs.nestjs.com/guards"><strong>use guards nestjs</strong></a></blockquote><p>I had the API hooked up to the web client in what I thought was a working state. I realized later that the nice comments in the example <a href="https://github.com/nestjs/nest/blob/47f0fa0ab5f7824a257eb7047f2e50513358032a/sample/19-auth/src/auth/auth.service.ts#L18">GitHub repository</a> would need to be followed and implemented. After some worrying: <strong><em>authentication with jwt</em></strong> <strong><em>secure</em></strong>🔎<a href="https://auth0.com/blog/brute-forcing-hs256-is-possible-the-importance-of-using-strong-keys-to-sign-jwts/"> <strong><em>jwt brute force</em></strong></a>🔎 <strong><em>generate good jwt secret</em></strong>🔎 I needed a place to store my <a href="https://passwordsgenerator.net/">newly generated secret</a> . I turned to <a href="https://www.npmjs.com/package/dotenv"><strong><em>dotenv</em></strong></a>🔎 to handle configuration files, and of course had to search <a href="https://stackoverflow.com/a/19610971/3072752"><strong><em>how to name something starting with a dot in finder</em></strong></a>🔎. I started off with using purely environment variables and accessing them within the code from process.env.ENVIRONMENT_VARIABLE, but soon after <strong><em>nestjs configuration documentation</em></strong>🔎, I found my way back to the <a href="https://docs.nestjs.com/techniques/configuration">NestJS documentation</a> which suggests using <a href="https://www.npmjs.com/package/joi"><strong><em>joi npm</em></strong></a>🔎 for validation. I followed the <em>advanced configuration</em> and made a global module <a href="https://docs.nestjs.com/modules"><strong><em>nestjs global modules</em></strong></a>🔎. To round out my “security audit” I <a href="https://docs.nestjs.com/techniques/security">read</a> and implemented <strong><em>nestjs force ssl</em></strong>🔎 for production</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eea95fe2618fc1064304073b5343cba/href">https://medium.com/media/0eea95fe2618fc1064304073b5343cba/href</a></iframe><p>After <em>quite</em> a few searches</p><blockquote><strong><em>🔎<br></em>- express-sslify nestjs<br>- ssl “nestjs”<br>- nestjs redirect https<br>- res.redirect is not a function express-sslify</strong><br><strong>-</strong> <a href="https://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s/35093587#35093587"><strong>301 moved permanently from disk cache</strong></a><br><strong>- </strong><a href="https://help.heroku.com/J2R1S4T8/can-heroku-force-an-application-to-use-ssl-tls"><strong>redirected you too many times https express</strong></a></blockquote><p>began to add <a href="https://github.com/expressjs/csurf">CSRF protection</a> <strong><em>csurf</em>🔎 </strong>until I decided it was unnecessary at this time.</p><h4>Deploying to Heroku</h4><p>The next step was deployment to <a href="https://heroku.com/">Heroku</a>. Of course it did not work on the first try. I fixed <strong><em>bcrypt failing heroku</em>🔎 </strong>by installing a new version, same with <strong><em>ts-node not found</em>🔎</strong>, and an error that stumped me for a while — <strong><em>web process failed to bind to $PORT within 60 seconds of launch wait longer</em>🔎. </strong>I originally thought I might <a href="https://devcenter.heroku.com/articles/dynos#web-dynos">need more time</a>, but I actually needed to dynamically set the port according to the environment variable that <a href="https://devcenter.heroku.com/articles/runtime-principles#web-servers">Heroku assigns</a>. When that still did not fix the problem<strong><em> app.listen string or number</em>🔎 <em>nestjs heroku port</em>🔎<em> nestjs heroku deploy</em>🔎 </strong>showed me the host was required to be set to 0.0.0.0.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/674c53eabf39ac2918faaa2e5c5fcfca/href">https://medium.com/media/674c53eabf39ac2918faaa2e5c5fcfca/href</a></iframe><p>I was then back to errors that I had seen before! This time concerning the environment variables. I was confused how the variables worked on Heroku, and realized after a bit of searching:</p><blockquote><strong><em>🔎<br>- </em>heroku dotenv<br>- push file to heroku<br>- put dotenv file in Heroku<br>- </strong><a href="https://stackoverflow.com/a/42112309/3072752"><strong>“Dotenv” “heroku” site:stackoverflow.com</strong></a><strong><br>- dotenv parse current process env variables<br>- “Get all” environment variables dotenv</strong></blockquote><p>dotenv does not work with Heroku because the .envfile should never be committed. This is for good reason since your secrets would not be secret. Therefore, I solved the problem by either using the file (if found) or checking for environment variables that are already set and <em>then </em>validating them.</p><blockquote><strong><em>🔎</em></strong><br><strong>- </strong><a href="https://stackoverflow.com/a/50538750/3072752"><strong>get keys from object into different object specific</strong></a><strong><br>- get variables out of process.env<br>- assign specific object properties to new object<br>- </strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce&#39;"><strong>reduce mdn</strong></a></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/432e7d9846dd801dc21bd565bc3c0c6d/href">https://medium.com/media/432e7d9846dd801dc21bd565bc3c0c6d/href</a></iframe><p>With that done, more errors came up that looked like a typescript compilation problem, but with weird errors like cannot find global type ‘Boolean’.</p><blockquote><strong><em>🔎</em><br>- </strong><a href="https://github.com/apollographql/graphql-subscriptions/issues/83#issuecomment-312469236"><strong>‘AsyncIterator’. Do you need to change your target library?</strong></a><strong><br>- cannot find global type ‘Boolean’.<br>- cannot find name ‘Blob’<br>- </strong><a href="https://github.com/apollographql/apollo-cache-control/issues/4#issuecomment-386383679"><strong>invalid module name in augmentation. Module ‘graphql/type/definition’</strong></a><strong><br>- unexpected token { import<br>-</strong> <a href="https://stackoverflow.com/a/43391502/3072752"><strong>tsc not converting imports</strong></a></blockquote><p>Almost everyone pointed towards fixes through tsconfig.json, yet suggestions to change the lib to <strong>X</strong> would remove <strong>Y</strong> error, but add <strong>Z</strong> error. I ended up with a tsconfig.jsonthat worked, but unfortunately I could not tell you why.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a82b0cb6b5367387a85ca057cdd0c62f/href">https://medium.com/media/a82b0cb6b5367387a85ca057cdd0c62f/href</a></iframe><p>Still, TypeORM was throwing errors, and it was at this time I realized the TypeORM entities</p><blockquote><strong><em>🔎</em><br>- </strong><a href="https://github.com/typeorm/typeorm/issues/682#issuecomment-316258575"><strong>no repository for “contact” was found</strong></a><strong><br>- typeorm entities<br>- </strong><a href="https://github.com/typeorm/typeorm/issues/682#issuecomment-331187289"><strong>looks like this entity is not registered in current “default” connection</strong></a></blockquote><p>were correctly found during development in the /src directory, but since production moves the files to the/dist directory, the entities were not correctly found. I changed where TypeORM looks for the entity files by changing src/**/*.entity.tsto dist/**/*.entity.js.</p><h4>Conclusion</h4><p>To great relief, the server successfully deployed and started serving requests. I have since gone on to add more functionality as well as run into more problems, but that’s development! Thanks for reading, and if you’re interested: a full list of <a href="https://hastebin.com/osoruhodir.txt">my searches</a>!</p><p><a href="https://www.camerakit.io/"><em>CameraKit</em></a><em> helps implement reliable Android camera into your mobile app easily. Open-source, performant, and optimized for tackling the complex Camera APIs on Android.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80043c6322f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/camerakit/building-a-nestjs-api-a-peek-through-my-search-history-80043c6322f0">Building a NestJS API — A Peek Through My Search History</a> was originally published in <a href="https://medium.com/camerakit">CameraKit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>