<?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>Forem: Kevin To</title>
    <description>The latest articles on Forem by Kevin To (@kevinqtogitty).</description>
    <link>https://forem.com/kevinqtogitty</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%2F969984%2Fe8c470fe-663c-47d7-9c7c-061eac7703bb.jpeg</url>
      <title>Forem: Kevin To</title>
      <link>https://forem.com/kevinqtogitty</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kevinqtogitty"/>
    <language>en</language>
    <item>
      <title>How to: Docker, typescript, and node</title>
      <dc:creator>Kevin To</dc:creator>
      <pubDate>Thu, 04 May 2023 17:28:33 +0000</pubDate>
      <link>https://forem.com/kevinqtogitty/how-to-docker-typescript-and-node-2iaa</link>
      <guid>https://forem.com/kevinqtogitty/how-to-docker-typescript-and-node-2iaa</guid>
      <description>&lt;h2&gt;
  
  
  Why Docker?
&lt;/h2&gt;

&lt;p&gt;To put it simply, we want to replicate the same environment on every machine our application will run on. &lt;/p&gt;

&lt;p&gt;Imagine my teammate an I are working with two different operating systems/machines, each of us has a different version of node installed. Well everything might be fine and dandy on my end but they might run into all kinds of node mismatch issues on their's. This is where Docker comes in.&lt;/p&gt;

&lt;p&gt;The Docker container replicates a desired standard environment for which our application will run in. So instead of directly running our application on whatever local machine and it's environment, we will run a docker container with that replicates the same environmental conditions (every time, everywhere) in which our application will run inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1: Checking your scripts
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ffzxbg3xphtpk3erzv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ffzxbg3xphtpk3erzv0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My build script will spit out a transpiled &lt;code&gt;index.js&lt;/code&gt; file in   &lt;code&gt;./app/server/build&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;My start script will run the built &lt;code&gt;index.js&lt;/code&gt; file found in said folder.&lt;/p&gt;

&lt;p&gt;Make sure your scripts are working correctly as Docker will run these scripts to run your application inside the container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2: The dockerfile &amp;amp; building your image
&lt;/h2&gt;

&lt;p&gt;The dockerfile is just a text document that contains the commands for docker to build your docker image. We can have different images with varying settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hold on, what is a docker image?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a docker image is an immutable file that contains the source code, libraries, dependancies, tools, and other files that are needed for a container to run. Essentially containers are &lt;strong&gt;instances&lt;/strong&gt; of images.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create the &lt;code&gt;dockerfile&lt;/code&gt;, and inside... &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5czqnygses9o9cy953y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5czqnygses9o9cy953y.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let's go line by line and figure out what's happening here.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;FROM node:18-alpine&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We specify a node version, alpine is just a lightweight/barebones node version used to run inside our container&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;WORKDIR /usr/src/app&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In our instanced environment we need to create a new directory for our files to live in&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;COPY package.json yarn.lock ./&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy first our &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;yarn.lock&lt;/code&gt; files into the root directory we just created, so we can install our dependencies needed for our application&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RUN yarn install&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the given command to install dependancies&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;COPY . .&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy over the rest of our files&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;EXPOSE 8080&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which port do we want our application to run on? In my node app I specified port 8080 so here I will do the same&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RUN yarn build&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we build to get our &lt;code&gt;index.js&lt;/code&gt; file spat out into the build directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CMD ["yarn", "start"]&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;And lastly we start our application&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Part 3: .dockerignore file
&lt;/h2&gt;

&lt;p&gt;We want to keep our container instance slim, so we'll went to exclude unnecessary files. We can do that by first creating a &lt;code&gt;.dockerignore&lt;/code&gt; file in the root directory and filling it out with...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbb2hrnshrjx7g9e1dz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbb2hrnshrjx7g9e1dz2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 4: Running our container
&lt;/h2&gt;

&lt;p&gt;If you haven't already you'll want to download the latest version of Docker Desktop for your computer, and then start the application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Navigate to where your dockerfile is located in your terminal and then run the docker command &lt;code&gt;docker build . -t imageNameOfChoice&lt;/code&gt; the &lt;code&gt;-t&lt;/code&gt; flag allows you to give a name/tag to your image that you are about to build&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once that has finished building we want to instance/run a container from the image that we just built. Run the docker command &lt;code&gt;docker run -d imageNameOfChoice&lt;/code&gt;. the &lt;code&gt;-d&lt;/code&gt; flag runs our container in detached mode, meaning it is disconnected from the current terminal so we can continue to use other commands. This mode means the container receives no input and displays no output.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detached mode will spit out a long id that references your container&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can check the currently running docker container/containers by running the docker command &lt;code&gt;docker ps&lt;/code&gt;. You will see the randomly generated name of your running container along with the id that was given to you from running in detached mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visit &lt;code&gt;localhost:8080&lt;/code&gt; and see your container running.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To stop your container simply run &lt;code&gt;docker stop randomlyGeneratedContainerName&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;So far we've learned how to write a setup a dockerfile to create an image and build and run a container. Stay tuned for more on how to connect other services like a DB/Redis in the future!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>typescript</category>
      <category>node</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>I'm SPRUNG! A react-spring series // Part 1: Intro &amp; the useSpring hook 🦘</title>
      <dc:creator>Kevin To</dc:creator>
      <pubDate>Sun, 11 Dec 2022 11:07:32 +0000</pubDate>
      <link>https://forem.com/kevinqtogitty/part-1-intro-the-usespring-hook-gjb</link>
      <guid>https://forem.com/kevinqtogitty/part-1-intro-the-usespring-hook-gjb</guid>
      <description>&lt;h1&gt;
  
  
  I'm SPRUNG!
&lt;/h1&gt;

&lt;p&gt;Yes this series is named after the 2005 song by T-Pain... &lt;/p&gt;

&lt;h2&gt;
  
  
  What is React Spring?
&lt;/h2&gt;

&lt;p&gt;React Spring is a &lt;strong&gt;spring-physics&lt;/strong&gt; based animation library. Instead of manipulating time, we give our elements mass, tension, and friction to mimic how things move from one position to another in real life. &lt;/p&gt;

&lt;h2&gt;
  
  
  Ok then... so how do we actually animate things?
&lt;/h2&gt;

&lt;p&gt;First we have to get a few things out of the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The &lt;code&gt;animated&lt;/code&gt; component
&lt;/h2&gt;

&lt;p&gt;We can only animate &lt;code&gt;animated&lt;/code&gt; components, these are provided by the &lt;code&gt;react-spring&lt;/code&gt; library. We can also use &lt;code&gt;a&lt;/code&gt; to denote an animated component as well&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { animated, a } from '@react-spring/web'

&amp;lt;animated.div /&amp;gt; // will animate

&amp;lt;span /&amp;gt; // won't animated

&amp;lt;a.h2 /&amp;gt; // will animate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. We define our springs in &lt;strong&gt;two&lt;/strong&gt; ways:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;As an config object&lt;/li&gt;
&lt;li&gt;Or as an anonymous function passed into the hook
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This spring will run when the component mounts 

const spring = useSpring({
    from: {opacity: 0, 'translateY(100%)'},
    to: {opacity: 1, 'translateY(0)'}
})

// This spring will run based on state

const [active, setActive] = useState(false)

const spring = useSpring({
    opacity: active ? 1 : 0,
    transform: active ? 'translateY(0%)' : 'translateY(100%)'
})

/*
   And lastly we can use an imperative method. We use array 
   destructuring to receive a controller object. We just need 
   to pass an anonymous function with our config object.
   This method doesn't rely on the components lifecycle. 
*/ 

  const [styles, api] = useSpring(() =&amp;gt; ({
    opacity: 0,
    transform: 'translateY(100%)'
  }));

  api.start(({
    opacity: 1,
    transform: 'translateY(0%)'
  }))

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Our first animation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FLfIN9ga--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vc5z491kimgcgbgzitj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FLfIN9ga--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vc5z491kimgcgbgzitj.gif" alt="Image description" width="320" height="188"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [active, setActive] = useState(false)

const spring = useSpring({
   opacity: active ? 1 : 0,
   transform: active ? 'translateY(0%)' : 'translateY(100%)' 
})

const handleClick = () =&amp;gt; {
   setActive(state =&amp;gt; !state)
}

return (
    &amp;lt;a.p style={spring}&amp;gt;Poof!&amp;lt;a.p&amp;gt;
    &amp;lt;button onClick={handleClick}&amp;gt;Click Me!&amp;lt;/button&amp;gt;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above we see that the spring will only trigger based on the state of &lt;code&gt;active&lt;/code&gt;. By default it will be invisible, and its starting position will be 100% of its origin on the Y axis (this means it will animate bottom - up). We've also passed the whole spring. But we can also use the spread operator...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return (
    &amp;lt;a.p {...spring}&amp;gt;Poof!&amp;lt;a.p&amp;gt;
    &amp;lt;button onClick={handleClick}&amp;gt;Click Me!&amp;lt;/button&amp;gt;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Our second animation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cgO-tTyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/namestj47icqd4f83jut.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cgO-tTyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/namestj47icqd4f83jut.gif" alt="Image description" width="800" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But what if we want to apply this spring to multiple elements   in an array? React-spring has a dedicated hook for that &lt;code&gt;useSprings&lt;/code&gt;, which we'll cover in the next post, but we can actually use the &lt;code&gt;useSpring&lt;/code&gt; hook to do this, although it will be limited. All we have to do is map over the array and apply it to each rendered jsx element&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
  Lets say we have four boxes we want to spin and turn into 
  circles
*/
const Example = () =&amp;gt; {
   const [active, setActive] = useState(false)
   const elements = ['Item 1', 'Item 2', 'Item 3', 'Item 4']

   const animation2 = useSpring({
       transform: isActive ? 'rotate(720deg)' : 'rotate(0deg)',
       borderRadius: isActive ? '50% 50%' : '0% 0%',
       backgroundColor: isActive ? '#FF7518' : 'rgb(255, 255, 255)',
       color: isActive ? 'rgb(255, 255, 255)' : 'rgb(0, 0, 0)',
       transformOrigin: 'center',
   });

   const handleClick = () =&amp;gt; {
      setActive(state =&amp;gt; !state)
   }

   return (
      {elements.map(el =&amp;gt; &amp;lt;a.p style={spring}&amp;gt;{el}&amp;lt;a.p&amp;gt;)}
      &amp;lt;button onClick={handleClick}&amp;gt;Click Me!&amp;lt;/button&amp;gt;
   )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is nice if you simply want all the elements to have the same animation all happening at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Things to note about the &lt;code&gt;useSpring&lt;/code&gt; hook:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Components will reverse their animation when tied to a state variable. If using the imperative method, springs will jump from the end state to the beginning position and run again&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remember that your components, even if their opacity is set to 0, they are still mounted on the DOM. They're &lt;strong&gt;never unmounted&lt;/strong&gt;. We will take a look at mounting and un-mounting elements using the &lt;code&gt;useTransition&lt;/code&gt; hook in the future &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This wraps up the first part of the react-spring series! So stay tuned for part 2 on the &lt;code&gt;useSprings&lt;/code&gt; hook!&lt;/p&gt;

</description>
      <category>react</category>
      <category>tutorial</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to set up an Express Server with Typescript and ES6 import statements using Vite</title>
      <dc:creator>Kevin To</dc:creator>
      <pubDate>Thu, 10 Nov 2022 09:43:32 +0000</pubDate>
      <link>https://forem.com/kevinqtogitty/how-to-set-up-an-express-server-with-typescript-and-es6-import-statements-using-vite-9l6</link>
      <guid>https://forem.com/kevinqtogitty/how-to-set-up-an-express-server-with-typescript-and-es6-import-statements-using-vite-9l6</guid>
      <description>&lt;p&gt;Require this, require that... ugh! It's 2022 man!&lt;/p&gt;

&lt;p&gt;I remember setting up my server for the first time with typescript while trying to use import and export statements... my god that was a painful day. &lt;/p&gt;

&lt;p&gt;So I'm here to save you all that trouble and show you how you can setup a typescript server super easily with ES6 import statements. We're going to use Vite to bypass all that boring  setup, and get straight to the meat of things.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initialize a new project
&lt;/h2&gt;

&lt;p&gt;First cd into the folder where you keep your projects and run this command to intialize a new Vite project. Follow the prompts and select react and typescript. CD into you project and run the command &lt;code&gt;yarn install&lt;/code&gt; to install all the dependancies. And we're off to the races!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nr1i8Nl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4tt4ozdory3d6n2npku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nr1i8Nl5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4tt4ozdory3d6n2npku.png" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install packages
&lt;/h2&gt;

&lt;p&gt;First things first we need a few packages. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Express framework itself&lt;/li&gt;
&lt;li&gt;The types for our express objects&lt;/li&gt;
&lt;li&gt;ts-node which allows us to run our server in node.js without having to precompile&lt;/li&gt;
&lt;li&gt;and nodemon which will restart our server every time we make a change&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2QCuyIYl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb800a6gyhta4dz0zw53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2QCuyIYl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb800a6gyhta4dz0zw53.png" alt="Image description" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Toggle esModuleInterop
&lt;/h2&gt;

&lt;p&gt;In you tsconfig under compiler options set the esModuleInterop to 'true'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---uPf-ZDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2f0zuep7acbrk8krogyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---uPf-ZDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2f0zuep7acbrk8krogyi.png" alt="Image description" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup your server
&lt;/h2&gt;

&lt;p&gt;Setup your typescript server. I'm calling mine server.ts and for this example it will be located inside the src directory&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Xx_M0gc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ps5zb6cri3xbd0byvi7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Xx_M0gc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ps5zb6cri3xbd0byvi7.png" alt="Image description" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Edit package.json
&lt;/h2&gt;

&lt;p&gt;In you package.json add "type": "module" (if its not already there) to enable ES6 import syntax, and set your nodemon script with the filepath to your server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tuH3Rk1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zryz0btoxm6mvf3qd8s7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tuH3Rk1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zryz0btoxm6mvf3qd8s7.png" alt="Image description" width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Run it!
&lt;/h1&gt;

&lt;p&gt;And finally all we have to do is run our script. And we're all good to go!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lwbiLgnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfs0we5e9pmtohiqk1de.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lwbiLgnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfs0we5e9pmtohiqk1de.png" alt="Image description" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
