<?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: mkop</title>
    <description>The latest articles on Forem by mkop (@kop7).</description>
    <link>https://forem.com/kop7</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%2F339708%2F0c223a4b-46f6-470a-be98-0caecaaa72a9.jpeg</url>
      <title>Forem: mkop</title>
      <link>https://forem.com/kop7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kop7"/>
    <language>en</language>
    <item>
      <title>How To Build Autocomplete search with Nestjs, Elasticsearch and Vue</title>
      <dc:creator>mkop</dc:creator>
      <pubDate>Sun, 09 Aug 2020 06:09:01 +0000</pubDate>
      <link>https://forem.com/kop7/how-to-build-autocomplete-search-with-nestjs-elasticsearch-and-vue-12h8</link>
      <guid>https://forem.com/kop7/how-to-build-autocomplete-search-with-nestjs-elasticsearch-and-vue-12h8</guid>
      <description>&lt;p&gt;&lt;a href="https://i.giphy.com/media/dVcFFjF3hXihQNnxAS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/dVcFFjF3hXihQNnxAS/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this Post, we will cover&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create and build docker images&lt;/li&gt;
&lt;li&gt;create and setup Nest app&lt;/li&gt;
&lt;li&gt;configure Elasticsearch with Nest app&lt;/li&gt;
&lt;li&gt;create and setup Vue app&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  let's start
&lt;/h1&gt;

&lt;p&gt;Project root directory structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── client
├── server
└── dev.yml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1. Setup Nest and Elasticsearch
&lt;/h2&gt;

&lt;p&gt;Server directory structure:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── src
│   ├── config
│   │   ├── config.module.ts
│   │   └── config.service.ts
│   ├── modules
│   │   ├── movie
│   │   │   ├── movie.controller.ts
│   │   │   ├── movie.module.ts
│   │   │   └── movie.service.ts
│   │   └── search
│   │       ├── search.module.ts
│   │       └── search.service.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── main.ts
│   └── typings.d.ts
├── Dockerfile
├── .env
├── movies.json
├── package.json
└── tslint.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;ConfigModule and ConfigService&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;in the ConfigModule we have to import env variables in project&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;config.module.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;config.service.ts&lt;/code&gt;&lt;br&gt;&lt;/p&gt;

&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SearchModule and SearchService&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;in the SearchModule we have to configure Elasticsearch and fill &lt;code&gt;movie-index&lt;/code&gt; with data from &lt;code&gt;movies.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;movie-index&lt;/code&gt;automatically created when you start a project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;search.module.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;search.service.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MovieModule, MovieService and MovieController&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;we create MovieController, MovieService and import SearchModule for access method &lt;code&gt;search&lt;/code&gt; in SearchService&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;movie.module.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;movie.controller.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;movie.service.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AppModule&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;in this step we will create healthcheck endpoint in AppController for docker health. &lt;br&gt;
we have to import MovieModule, ConfigModule and SearchModule into AppModule&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;app.module.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;app.controller.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;main.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;create server/Dockerfile&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;docker image for Nest app&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:13&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app/server&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run build
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000/tcp&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; [ "node", "dist/main.js" ]&lt;/span&gt;

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

&lt;h4&gt;
  
  
  Create .env file in server directory
&lt;/h4&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#App
APP_ENV=dev
GLOBAL_PREFIX=api
#Elastic
ELASTICSEARCH_NODE=http://dockerip:9200
NODE_PORT=3000
ELASTICSEARCH_INDEX=movies-index
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;how to find elastic url in docker:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nest-elasticsearch&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Replace the given dockerIp with &lt;code&gt;ELASTICSEARCH_NODE=http://dockerIp:9200&lt;/code&gt; in .env&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  2. Setup Vue app
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Client directory structure:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── Dockerfile
├── package.json
├── public
│   └── index.html
└── src
    ├── App.vue
    ├── asset
    ├── components
    │   └── Home.vue
    ├── main.js
    ├── plugins
    │   └── boostrap-vue.js
    └── router.js

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


&lt;ul&gt;
&lt;li&gt;&lt;code&gt;App.vue&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;router-view&amp;gt;&lt;/code&gt; The  component is a functional component that renders the matched component for the given path. Components rendered in &lt;code&gt;&amp;lt;router-view&amp;gt;&lt;/code&gt; can also contain their own &lt;code&gt;&amp;lt;router-view&amp;gt;&lt;/code&gt;, which will render components for nested paths.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Home.vue&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boostrap-vue.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;setup boostrap with vue&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;code&gt;main.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;router.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;create client/Dockerfile&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;docker for Vue app&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:11.1-alpine as develop-stage&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app/client&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; develop-stage as build-stage&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run build
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build-stage /app/client/dist /usr/share/nginx/html&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 80&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["nginx", "-g", "daemon off;"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Setup Docker for project
&lt;/h2&gt;
&lt;h4&gt;
  
  
  why use Docker?
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Docker is a tool designed to make it easy to create, deploy and run application by using containers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.docker.com/engine/install"&gt;install docker&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;create dev.yml&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Check out the full project on &lt;a href="https://github.com/kop7/nest-elasticsearch-vue"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  That's it!
&lt;/h1&gt;

&lt;p&gt;Feel free to ask questions, make comments or suggestions, or just say hello in the comments below.&lt;/p&gt;

</description>
      <category>node</category>
      <category>elasticsearch</category>
      <category>vue</category>
      <category>nestjs</category>
    </item>
    <item>
      <title>Library for Http errors in Typescript</title>
      <dc:creator>mkop</dc:creator>
      <pubDate>Fri, 13 Mar 2020 09:39:35 +0000</pubDate>
      <link>https://forem.com/kop7/library-for-http-errors-in-typescript-4eek</link>
      <guid>https://forem.com/kop7/library-for-http-errors-in-typescript-4eek</guid>
      <description>&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%2Fi%2Ffhvcw6n93q73lz4by6dh.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%2Fi%2Ffhvcw6n93q73lz4by6dh.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  HTTP errors response
&lt;/h1&gt;

&lt;p&gt;This library provide some Error response classes to map the problems that you may want to report to your clients.&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;npm install http-errors-response-ts --save&lt;/p&gt;

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

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Usage&lt;br&gt;
&lt;/h3&gt;

&lt;h5&gt;
  
  
  import error response from lib
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BadRequestResponse&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http-errors-response-ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BadRequestResponse&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h6&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  expexted object&lt;br&gt;
&lt;/h6&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"statusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bad Request"&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;
&lt;h5&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  with custom message&lt;br&gt;
&lt;/h5&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BadRequestResponse&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http-errors-response-ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BadRequestResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Custom message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h6&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  expexted object&lt;br&gt;
&lt;/h6&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"statusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Custom message"&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  List of all Error&lt;br&gt;
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status Code&lt;/th&gt;
&lt;th&gt;Error Name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;BadRequestResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;UnauthorizedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;402&lt;/td&gt;
&lt;td&gt;PaymentRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;td&gt;ForbiddenResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;404&lt;/td&gt;
&lt;td&gt;NotFoundResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;405&lt;/td&gt;
&lt;td&gt;MethodNotAllowedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;406&lt;/td&gt;
&lt;td&gt;NotAcceptableResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;407&lt;/td&gt;
&lt;td&gt;ProxyAuthenticationRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;408&lt;/td&gt;
&lt;td&gt;RequestTimeoutResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;409&lt;/td&gt;
&lt;td&gt;ConflictResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;410&lt;/td&gt;
&lt;td&gt;GoneResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;411&lt;/td&gt;
&lt;td&gt;LengthRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;412&lt;/td&gt;
&lt;td&gt;PreconditionFailedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;413&lt;/td&gt;
&lt;td&gt;PayloadTooLargeResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;414&lt;/td&gt;
&lt;td&gt;URITooLongResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;415&lt;/td&gt;
&lt;td&gt;UnsupportedMediaTypeResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;416&lt;/td&gt;
&lt;td&gt;RangeNotSatisfiableResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;417&lt;/td&gt;
&lt;td&gt;ExpectationFailedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;418&lt;/td&gt;
&lt;td&gt;ImATeapotResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;421&lt;/td&gt;
&lt;td&gt;MisdirectedRequestResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;422&lt;/td&gt;
&lt;td&gt;UnprocessableEntityResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;423&lt;/td&gt;
&lt;td&gt;LockedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;424&lt;/td&gt;
&lt;td&gt;FailedDependencyResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;425&lt;/td&gt;
&lt;td&gt;UnorderedCollectionResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;426&lt;/td&gt;
&lt;td&gt;UpgradeRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;428&lt;/td&gt;
&lt;td&gt;PreconditionRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;429&lt;/td&gt;
&lt;td&gt;TooManyRequestsResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;431&lt;/td&gt;
&lt;td&gt;RequestHeaderFieldsTooLargeResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;451&lt;/td&gt;
&lt;td&gt;UnavailableForLegalReasonsResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;td&gt;InternalServerErrorResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;501&lt;/td&gt;
&lt;td&gt;NotImplementedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;502&lt;/td&gt;
&lt;td&gt;BadGatewayResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;503&lt;/td&gt;
&lt;td&gt;ServiceUnavailableResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;504&lt;/td&gt;
&lt;td&gt;GatewayTimeoutResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;505&lt;/td&gt;
&lt;td&gt;HTTPVersionNotSupportedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;506&lt;/td&gt;
&lt;td&gt;VariantAlsoNegotiatesResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;507&lt;/td&gt;
&lt;td&gt;InsufficientStorageResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;508&lt;/td&gt;
&lt;td&gt;LoopDetectedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;509&lt;/td&gt;
&lt;td&gt;BandwidthLimitExceededResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;510&lt;/td&gt;
&lt;td&gt;NotExtendedResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;511&lt;/td&gt;
&lt;td&gt;NetworkAuthenticationRequiredResponse&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  That's it!
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/http-errors-response-ts" rel="noopener noreferrer"&gt;npm package&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Feel free to ask questions, make comments or suggestions, or just say hello in the comments below.
&lt;/h6&gt;

</description>
      <category>typescript</category>
      <category>http</category>
      <category>node</category>
    </item>
    <item>
      <title>How to Use Serverless with NestJS</title>
      <dc:creator>mkop</dc:creator>
      <pubDate>Sun, 23 Feb 2020 11:14:16 +0000</pubDate>
      <link>https://forem.com/kop7/how-to-use-serverless-with-nestjs-2peg</link>
      <guid>https://forem.com/kop7/how-to-use-serverless-with-nestjs-2peg</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H6FuAwh5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rv9gajiez56cwbng8gyc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H6FuAwh5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rv9gajiez56cwbng8gyc.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Need an example of how to get started with NestJS and Serverless framework?&lt;/p&gt;

&lt;p&gt;NestJS is a back-end framework for creating scalable applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Getting Started
&lt;/h1&gt;

&lt;h3&gt;
  
  
  NestJS
&lt;/h3&gt;

&lt;p&gt;To start playing with NestJS you should have node (version &amp;gt;= 8.9.0) and npm installed. You can download and install Node from the official website.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a database automatically
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--name&lt;/span&gt; mysql57 &lt;span class="nt"&gt;-p&lt;/span&gt; 3306:3306 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;superpassword &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pass &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mydb &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-d&lt;/span&gt; mysql/mysql-server:5.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Serverless framework
&lt;/h3&gt;

&lt;p&gt;For serverless you need to install the required package globally:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install serverless -g&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To follow this tutorial, you are going to need clone repository &lt;a href="https://github.com/kop7/serverless-nestjs-typeorm"&gt;NestJS-Serverless-TypeOrm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now just start application:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run sls:offline&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/LS49VrcrRAgYyp5sIM/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/LS49VrcrRAgYyp5sIM/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's create the first author in the application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/WTESQLYZpFMDM95cPZ/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/WTESQLYZpFMDM95cPZ/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/Y15E6Z6PoI04AzjHfd/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/Y15E6Z6PoI04AzjHfd/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can try crud operations on Author&lt;/p&gt;

&lt;h1&gt;
  
  
  That's it!
&lt;/h1&gt;

&lt;p&gt;Feel free to ask questions, make comments or suggestions, or just say hello in the comments below. &lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>node</category>
      <category>mysql</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
