<?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: Abdelrahman Ashraf</title>
    <description>The latest articles on DEV Community by Abdelrahman Ashraf (@theashraf).</description>
    <link>https://dev.to/theashraf</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%2F111284%2F13d93f6a-dcfa-4173-a372-73ae3521c7c6.jpeg</url>
      <title>DEV Community: Abdelrahman Ashraf</title>
      <link>https://dev.to/theashraf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/theashraf"/>
    <language>en</language>
    <item>
      <title>Create your own node framework</title>
      <dc:creator>Abdelrahman Ashraf</dc:creator>
      <pubDate>Sat, 24 Aug 2019 22:44:58 +0000</pubDate>
      <link>https://dev.to/theashraf/create-your-own-node-framework-38mi</link>
      <guid>https://dev.to/theashraf/create-your-own-node-framework-38mi</guid>
      <description>&lt;p&gt;I've created a simple node framework just to get the idea behind node frameworks like express.&lt;/p&gt;

&lt;p&gt;check the code in this repo.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/theashraf"&gt;
        theashraf
      &lt;/a&gt; / &lt;a href="https://github.com/theashraf/bare-node"&gt;
        bare-node
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple Node framework
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Simple Node framework&lt;/h1&gt;
&lt;h2&gt;
what&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A simple node framework with zero dependency&lt;/li&gt;
&lt;li&gt;An Express like framework that implements the middleware pattern&lt;/li&gt;
&lt;li&gt;For demonstration purpose only, not for production (maybe later)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
why&lt;/h2&gt;
&lt;p&gt;To get the idea behind node frameworks specially express (the most popular node framework)&lt;/p&gt;
&lt;h2&gt;
How&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Middlewares handling is being implemented using the chain of responsibility pattern, check &lt;code&gt;lib/App.js&lt;/code&gt; to see the implementaion details&lt;/li&gt;
&lt;li&gt;Extending the &lt;code&gt;http.ServerResponse&lt;/code&gt; object functionality by adding some util method that make it easier to send response, it uses the builder pattern to build the response before sending it to the client, check &lt;code&gt;lib/Response.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Adding &lt;code&gt;BodyParser&lt;/code&gt; middleware that parse the request body by listening to the &lt;code&gt;http.IncommingMessage&lt;/code&gt; on &lt;code&gt;data&lt;/code&gt; event and keep concatinating the incomming buffer chunks until the &lt;code&gt;end&lt;/code&gt; event fires, then it will call the next middleware after adding the &lt;code&gt;body&lt;/code&gt; object to the &lt;code&gt;req&lt;/code&gt; , so later we can access the body in our…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/theashraf/bare-node"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


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