<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Graphql on David Lang</title>
    <link>https://www.davidlang.tech/tags/graphql/</link>
    <description>Recent content in Graphql on David Lang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 17 Apr 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.davidlang.tech/tags/graphql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Simple Notes app using React, TypeScript, Node.js, GraphQL and MongoDB</title>
      <link>https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/</link>
      <pubDate>Mon, 17 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/</guid>
      <description>&lt;p&gt;In the series of the blog post, I am going to walk through step by step process of building a &lt;a href=&#34;https://github.com/rasikjain/SimpleNotes&#34;&gt;Simple Notes&lt;/a&gt; App using &lt;a href=&#34;https://reactjs.org/&#34;&gt;React&lt;/a&gt;, &lt;a href=&#34;https://www.typescriptlang.org/&#34;&gt;TypeScript&lt;/a&gt;, &lt;a href=&#34;https://nodejs.org/en/&#34;&gt;Node.js&lt;/a&gt;, &lt;a href=&#34;https://graphql.org/&#34;&gt;GraphQL &lt;/a&gt;, and &lt;a href=&#34;https://www.mongodb.com/&#34;&gt;MongoDB&lt;/a&gt;. During the process of our development, we are going to use some useful npm packages like &lt;a href=&#34;https://expressjs.com/&#34;&gt;Express&lt;/a&gt;, &lt;a href=&#34;https://www.apollographql.com/docs/apollo-server&#34;&gt;Apollo-Server&lt;/a&gt;, &lt;a href=&#34;https://github.com/typegoose/typegoose&#34;&gt;Typegoose&lt;/a&gt;, &lt;a href=&#34;https://mongoosejs.com/&#34;&gt;Mongoose&lt;/a&gt;, &lt;a href=&#34;https://typegraphql.com/&#34;&gt;TypeGraphQL &lt;/a&gt;, and &lt;a href=&#34;https://getbootstrap.com/&#34;&gt;Bootstrap&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the Github &lt;a href=&#34;https://github.com/rasikjain/SimpleNotes&#34;&gt;Source Code&lt;/a&gt; to run the application.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Table of Content&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#dev-environment-setup&#34;&gt;Dev Environment Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#graphql-server-backend&#34;&gt;GraphQL Server Backend&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#folder-structure&#34;&gt;Folder Structure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#creating-nodejs-project&#34;&gt;Creating Node.js project&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#configuring-typescript&#34;&gt;Configuring TypeScript&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#installing-dependency-packages&#34;&gt;Installing Dependency Packages&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#mongoose-schema-and-graphql-schema&#34;&gt;Mongoose Schema and GraphQL Schema&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#graphql-resolvers&#34;&gt;GraphQL Resolvers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#mongo-database-setup&#34;&gt;Mongo Database Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#environment-configuration&#34;&gt;Environment Configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#nodejs-server-setup&#34;&gt;Node.js Server Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#config-files&#34;&gt;Config files&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#packagejson&#34;&gt;package.json&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#nodemonjson-configuration&#34;&gt;nodemon.json configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#running-nodejs--server&#34;&gt;Running node.js / Server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;dev-environment-setup&#34;&gt;Dev Environment Setup&lt;/h3&gt;&#xA;&lt;p&gt;We are going to set up our initial codebase and folder structure to get started. In this tutorial, I am going to use the Windows environment. The command structure is mostly the same and can be easily replicated to macOS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Introduction to GraphQL: Why It Matters</title>
      <link>https://www.davidlang.tech/posts/introduction-to-graphql-why-it-matters/</link>
      <pubDate>Sat, 25 Jul 2020 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/introduction-to-graphql-why-it-matters/</guid>
      <description>&lt;p&gt;GraphQL is a query language for APIs that lets clients request exactly the fields they need. Unlike REST, you avoid over-fetching and under-fetching by design.&lt;/p&gt;&#xA;&lt;h2 id=&#34;schema-first-design&#34;&gt;Schema-First Design&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-graphql&#34; data-lang=&#34;graphql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;type&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;Query&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  user(id: &lt;span style=&#34;color:#268bd2&#34;&gt;ID&lt;/span&gt;!): &lt;span style=&#34;color:#268bd2&#34;&gt;User&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  posts(limit: &lt;span style=&#34;color:#268bd2&#34;&gt;Int&lt;/span&gt; = 10): [&lt;span style=&#34;color:#268bd2&#34;&gt;Post&lt;/span&gt;!]!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;type&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;User&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  id: &lt;span style=&#34;color:#268bd2&#34;&gt;ID&lt;/span&gt;!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  name: &lt;span style=&#34;color:#268bd2&#34;&gt;String&lt;/span&gt;!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  posts: [&lt;span style=&#34;color:#268bd2&#34;&gt;Post&lt;/span&gt;!]!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Clients send queries that mirror the shape of the response:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-graphql&#34; data-lang=&#34;graphql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;query&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#268bd2&#34;&gt;user&lt;/span&gt;(id: &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#34;1&amp;#34;&lt;/span&gt;) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#268bd2&#34;&gt;name&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    posts(limit: &lt;span style=&#34;color:#268bd2&#34;&gt;5&lt;/span&gt;) { title createdAt }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;server-implementation&#34;&gt;Server Implementation&lt;/h2&gt;&#xA;&lt;p&gt;Apollo Server and GraphQL Yoga are popular in Node.js. Resolvers map fields to databases or microservices. Use DataLoader to batch N+1 queries.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
