<?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: UJJWAL GUPTA</title>
    <description>The latest articles on DEV Community by UJJWAL GUPTA (@ujjwal_kr_gupta).</description>
    <link>https://dev.to/ujjwal_kr_gupta</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%2F73959%2Faf9dd86c-f2bd-4b24-a31a-1891d27a0237.jpeg</url>
      <title>DEV Community: UJJWAL GUPTA</title>
      <link>https://dev.to/ujjwal_kr_gupta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ujjwal_kr_gupta"/>
    <language>en</language>
    <item>
      <title>Express 5 is here, what’s new?</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Tue, 03 Dec 2024 12:13:29 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/express-5-is-here-whats-new-4lfk</link>
      <guid>https://dev.to/ujjwal_kr_gupta/express-5-is-here-whats-new-4lfk</guid>
      <description>&lt;p&gt;Expressjs is a popular framework for nodejs, you can say its foundation of nodejs. The current version is express 4 which is the most popular and stable version and work on next version Express5 was being done but super slow.&lt;/p&gt;

&lt;p&gt;Express5 is finally released after wait of 10 years with some major changes. In this article we are going to cover all these changes.&lt;/p&gt;

&lt;p&gt;If you prefers to watch videos, i have created a video with proper explanation and comparision with expressjs4.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/TsUpLjA5H5E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Here are 10 major changes in express 5.
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Support for es6
&lt;/h2&gt;

&lt;p&gt;Express5 now supports es6 which means we can use import instead of require and all other modern ecmascript features. This allows developers to write much cleaner code and use all modern javascript syntax.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Promise rejection support
&lt;/h2&gt;

&lt;p&gt;In express4 if you are using promise/async await code and if error happens, you had to manually catch the exception and then pass the error in next middleware.&lt;/p&gt;

&lt;p&gt;Express5 automatically handles this which means focus on your logic not handling the exception.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Builtin body parser
&lt;/h2&gt;

&lt;p&gt;In Express 4 we had to install seperate library “body-parser” for handling post data.&lt;/p&gt;

&lt;p&gt;Express 5 has body-parser integrated internally which means no extra dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. req.param(name) removed
&lt;/h2&gt;

&lt;p&gt;In earlier version of express — you could extract forms data using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;req.param(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This could be data from query, param or even body which confuses the source of data. This was already deprecated.&lt;/p&gt;

&lt;p&gt;But in express it has been completely removed. Now you need to explicitly use — &lt;code&gt;req.query&lt;/code&gt;, &lt;code&gt;req.body&lt;/code&gt; or &lt;code&gt;req.param&lt;/code&gt; based on where data is coming from.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. app.del replaced with app.delete
&lt;/h2&gt;

&lt;p&gt;In express 4 — the HTTP DELETE route was registered using app.del but in express5 it has been replaced with more explicit word delete, so you need to now use app.delete&lt;/p&gt;

&lt;h2&gt;
  
  
  6. app.param(fn) middleware is removed
&lt;/h2&gt;

&lt;p&gt;In express4 app.param middleware was used to defined middleware that executes whenever the route param was found. This was used to preprocess some data, for example — if a route param has userId then find the user from database and attach to the request which would be needed later.&lt;/p&gt;

&lt;p&gt;In express5 this has been removed and developers are encouraged to use more explicit approach that is use a middleware just before the route. This makes the things much clear and easy to debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. &lt;code&gt;res.send(status)&lt;/code&gt; replaced with &lt;code&gt;res.sendStatus(status)&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;In express 4 you could send a response without data using res.send which confused developers like where is the data, is it a bug or something different.&lt;/p&gt;

&lt;p&gt;In express5 an explicit method res.sendStatus is introduced for sending response with only status code and no data.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;code&gt;res.send&lt;/code&gt; sends data only
&lt;/h2&gt;

&lt;p&gt;In express 4, you could send response with status code and data using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res.send(stauts, data);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but in express5, the send method only accepts one parameter which is data and a method status has been added to send the status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res.status(status).send(data);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. &lt;code&gt;req.query&lt;/code&gt; is read only
&lt;/h2&gt;

&lt;p&gt;In express 4 , you could mutate the req.query — add aadditional property or remove.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;req.query.id =5 ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this creates confusion as source of data was not request but set somewhere explicitly in the code.&lt;/p&gt;

&lt;p&gt;In express 5, &lt;code&gt;req.query&lt;/code&gt; is read only which means no more changes on the req.query&lt;/p&gt;

&lt;h2&gt;
  
  
  10. &lt;code&gt;req.body&lt;/code&gt; is undefined by default
&lt;/h2&gt;

&lt;p&gt;In express 4, req.body value was empty object {}by default. So if you are in get request or you have not configured body parser the value of req.body will be empty object.&lt;/p&gt;

&lt;p&gt;But in express5, it will be undefined. Which will explicitly states that there is no body data.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Express 5 majorly focuses on -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Express 5 focuses on making things more clear and explicitly defined.&lt;/li&gt;
&lt;li&gt;Remove confusing parts&lt;/li&gt;
&lt;li&gt;Move external dependency to internal dependency&lt;/li&gt;
&lt;li&gt;Internal optimization&lt;/li&gt;
&lt;li&gt;Support for modern javascript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Thanks for reading everyone. Please let me know what do you think about express5 in the comments and follow me for more such articles.&lt;/p&gt;

&lt;p&gt;💁‍♂ Also if you like to watch tech videos, please subscribe to my youtube channel. Where i share lot of tech tips, news, experiment etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/@codewithujjwalgupta" rel="noopener noreferrer"&gt;https://www.youtube.com/@codewithujjwalgupta&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect with me at -&lt;/p&gt;

&lt;p&gt;Twitter — &lt;a href="https://twitter.com/ujjwal_kr_gupta" rel="noopener noreferrer"&gt;https://twitter.com/ujjwal_kr_gupta&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Linkedin — &lt;a href="https://www.linkedin.com/in/ujjwalkrgupta/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/ujjwalkrgupta/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github — &lt;a href="https://github.com/ujjwalguptaofficial" rel="noopener noreferrer"&gt;https://github.com/ujjwalguptaofficial&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>javascript</category>
      <category>api</category>
    </item>
    <item>
      <title>Fort.js: Revolutionizing Node.js Development - Simplicity, Speed, and Component-Based Modularity</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Wed, 24 Jan 2024 13:37:44 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/fortjs-revolutionizing-nodejs-development-simplicity-speed-and-component-based-modularity-1k0c</link>
      <guid>https://dev.to/ujjwal_kr_gupta/fortjs-revolutionizing-nodejs-development-simplicity-speed-and-component-based-modularity-1k0c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the ever-evolving landscape of web development, Node.js stands tall as a powerhouse for building scalable and efficient applications. However, the available frameworks often lead developers down a path where the focus is primarily on immediate application development, potentially sacrificing long-term maintainability and code cleanliness. This can pose challenges for new team members trying to understand and contribute to the codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contrast with Java and C# Ecosystems
&lt;/h2&gt;

&lt;p&gt;In ecosystems like Java and C#, developers benefit from robust frameworks that prioritize maintainability, making it easier for new team members to dive into the code. Fort.js emerges as a solution in the Node.js world, aiming to bridge the gap between powerful development and sustainable, understandable code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fort.js Approach:
&lt;/h2&gt;

&lt;p&gt;Fort.js leverages the strengths of modern JavaScript and TypeScript to address the challenges faced by Node.js developers. It introduces simple APIs and adopts the Fort architecture, promoting modularity through components without compromising on performance – reportedly three times faster than Express.js.&lt;/p&gt;

&lt;p&gt;Here is link to fortjs docs - &lt;a href="https://fortjs.net/"&gt;https://fortjs.net/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Component Advantage:
&lt;/h3&gt;

&lt;p&gt;One of Fort.js's standout features is its robust support for &lt;a href="https://fortjs.net/docs/component/"&gt;component-based development&lt;/a&gt;. Components enable developers to break down their applications into modular, self-contained units. This approach enhances maintainability, encourages code reusability, and facilitates collaboration among team members.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features of Fort.js with Component Support:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Dependency Injection: Similar to Nest.js, Fort.js embraces dependency injection, a cornerstone for building loosely coupled and easily testable components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MVC Architecture: Fort.js adheres to the Model-View-Controller (MVC) architecture, providing a structured approach for organizing components and promoting a clean separation of concerns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Express Middleware Support: Seamless integration with Express middleware ensures compatibility with a wide array of existing middleware modules, allowing developers to leverage the Node.js ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Typescript Friendliness: Fort.js fully supports TypeScript, offering developers the advantages of static typing for improved code quality and enhanced development experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Component-Based Modularity: Fort.js empowers developers with a robust component system, enabling them to modularize their code for enhanced maintainability and reusability. Components can be easily managed, tested, and reused across different parts of the application.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Comparison with Nest.js
&lt;/h2&gt;

&lt;p&gt;Nest.js, a widely adopted framework, embraces the architecture of Angular and is built on top of Express.js. While Nest.js attempts to address the challenges that Fort.js aims to solve, it can be perceived as complex, especially in simpler scenarios.&lt;/p&gt;

&lt;p&gt;The unnecessary abstraction and concepts such as modules, imports, providers, and exports may lead to a steeper learning curve and increased verbosity in Nest.js. Developers may find themselves entangled in solving issues related to dependency injection, module configuration, and order of operations, which can consume a significant amount of time.&lt;/p&gt;

&lt;p&gt;In contrast, Fort.js takes a different approach. Each API and functionality, including Dependency Injection (DI) and validation, is designed to be used in a straightforward manner. The goal is to enable developers to focus on the application's development rather than spending time fixing framework-related errors.&lt;/p&gt;

&lt;p&gt;Let's see an example of Dependency injection -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;singleton&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="s2"&gt;fortjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;UserService&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="s2"&gt;@/services&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;UserService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;singleton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;UserService&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You just need to pass your class in &lt;code&gt;singleton&lt;/code&gt; decorator and it will be injected and also managed as singleton. Much simple right?&lt;/p&gt;

&lt;p&gt;You can also inject dependency into route methods as required, check docs here - &lt;a href="https://fortjs.net/docs/concepts/dependency-injection#inject-into-controller-methods"&gt;https://fortjs.net/docs/concepts/dependency-injection#inject-into-controller-methods&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Fort.js framework aims to provide simplicity and clarity, ensuring that even in complex scenarios, developers can navigate and implement functionalities efficiently without unnecessary complications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Comparative Analysis
&lt;/h2&gt;

&lt;p&gt;Let's compare Fort.js, Nest.js, and Express.js, emphasizing Fort.js' ability to simplify development without compromising advanced features, especially in contrast to Nest.js complexity.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Nest.js&lt;/th&gt;
&lt;th&gt;Express.js&lt;/th&gt;
&lt;th&gt;Fort.js&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dependency Injection&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MVC Architecture&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Express Middleware&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Typescript Support&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Component-Based Modularity&lt;/td&gt;
&lt;td&gt;Yes (Complex)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;3x faster than Express.js&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Supporting Fort.js
&lt;/h2&gt;

&lt;p&gt;If you find Fort.js intriguing and would like to support the project, consider starring the &lt;a href="https://github.com/ujjwalguptaofficial/fortjs"&gt;Fort.js GitHub repository&lt;/a&gt;. Each star serves as motivation and helps boost confidence in the journey of refining and enhancing the framework.&lt;/p&gt;

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

&lt;p&gt;Fort.js not only offers a compelling alternative to Nest.js but does so with a focus on simplicity, speed, and component-based modularity. Addressing the potential complexities of Nest.js, Fort.js stands as a groundbreaking solution for teams seeking a more straightforward yet powerful approach to Node.js development.&lt;/p&gt;

&lt;p&gt;Please share the article and also please star the fortjs github repo at - &lt;a href="https://github.com/ujjwalguptaofficial/fortjs"&gt;https://github.com/ujjwalguptaofficial/fortjs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are some links :&lt;/p&gt;

&lt;p&gt;Fortjs doc link - &lt;a href="https://fortjs.net/"&gt;https://fortjs.net/&lt;/a&gt;&lt;br&gt;
Fortjs github link - &lt;a href="https://github.com/ujjwalguptaofficial/fortjs"&gt;https://github.com/ujjwalguptaofficial/fortjs&lt;/a&gt;&lt;br&gt;
Fortjs examples - &lt;a href="https://github.com/ujjwalguptaofficial/fortjs-examples"&gt;https://github.com/ujjwalguptaofficial/fortjs-examples&lt;/a&gt;&lt;br&gt;
Fortjs Author twitter handle - &lt;a href="https://twitter.com/ujjwal_kr_gupta"&gt;https://twitter.com/ujjwal_kr_gupta&lt;/a&gt;&lt;br&gt;
Fortjs Author linkedin handle - &lt;a href="https://www.linkedin.com/in/ujjwalkrgupta/"&gt;https://www.linkedin.com/in/ujjwalkrgupta/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Introducing Mahal.js</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Mon, 03 Oct 2022 16:06:26 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/introducing-mahaljs-44k9</link>
      <guid>https://dev.to/ujjwal_kr_gupta/introducing-mahaljs-44k9</guid>
      <description>&lt;p&gt;I have been working on an awesome project since last two years and now it is completed and I can't stop myself to share this with everyone. It was a very tough and interesting journey but i am glad i was able to finish it 😃.&lt;/p&gt;

&lt;p&gt;The project is named &lt;a href="https://github.com/ujjwalguptaofficial/mahal"&gt;mahaljs&lt;/a&gt;. It is a javascript UI framework similar to reactjs but works without virual DOM similar to Svelte.&lt;/p&gt;

&lt;p&gt;The project has been created from scratch. It has its own template engine, uses event based architecture(to make it feel native to javascript). All of its ecosytem projects like store, router etc has been also created from scratch. &lt;/p&gt;

&lt;p&gt;These are some of awesome features - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works without virtual DOM&lt;/li&gt;
&lt;li&gt;Small in size but powerful - 7kb (minified + gzipped)&lt;/li&gt;
&lt;li&gt;Truly reactive with two way binding&lt;/li&gt;
&lt;li&gt;Better documenting - you can write documentation with yml syntax inside components&lt;/li&gt;
&lt;li&gt;Event based architecture&lt;/li&gt;
&lt;li&gt;Uses modern approach - class based components, decorators etc&lt;/li&gt;
&lt;li&gt;Focuses on simplicity - simple API's and easy to learn&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have also created a documentation site. Here is link - &lt;a href="https://mahaljs.com/docs/get-started/"&gt;https://mahaljs.com/docs/get-started/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The mahaljs is opensource and free to use. The project source code can be viewed on github - &lt;a href="https://github.com/ujjwalguptaofficial/mahal"&gt;https://github.com/ujjwalguptaofficial/mahal&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might be wondering why i have created mahaljs, since already lots of framework exists. I have written a dedicated article to explain this, since everyone is asking the very same question - &lt;a href="https://medium.com/@ujjwalkrgupta/why-i-created-mahal-js-9141b37fc64"&gt;https://medium.com/@ujjwalkrgupta/why-i-created-mahal-js-9141b37fc64&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will request you to please try once 🙏 and share it with others if you liked it. Also feel free to contribute or create your own projects which can help community. Some of the projects ideas, i can think of are - bootstrap-mahal, materialize-mahal, alert UI, mahal-meta etc. Here is official ecosytem projects link - &lt;a href="https://mahaljs.com/docs/ecosystem/"&gt;https://mahaljs.com/docs/ecosystem/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also i am maintaining a dedicated blog for this projects, so that users can understand even smaller things and take advantage of it. Here is the link in case you want to join - &lt;a href="https://medium.com/mahal-js"&gt;https://medium.com/mahal-js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading it guys.&lt;/p&gt;

&lt;p&gt;Let's learn and grow together, join me using below social links -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Twitter - &lt;a href="https://twitter.com/ujjwal_kr_gupta"&gt;https://twitter.com/ujjwal_kr_gupta&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Linkedin - &lt;a href="https://www.linkedin.com/in/ujjwalkrgupta/"&gt;https://www.linkedin.com/in/ujjwalkrgupta/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Github - &lt;a href="https://github.com/ujjwalguptaofficial"&gt;https://github.com/ujjwalguptaofficial&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>framework</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Browser indexeddb operation using jsstore</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Wed, 15 May 2019 10:03:59 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/browser-indexeddb-operation-using-jsstore-1agg</link>
      <guid>https://dev.to/ujjwal_kr_gupta/browser-indexeddb-operation-using-jsstore-1agg</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;IndexedDB is a NoSQL database technology in HTML5 which allows storing the data and doing different database operations in the browsers. &lt;/p&gt;

&lt;p&gt;Properties of IndexedDB :-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is a NoSQL Database technology.&lt;/li&gt;
&lt;li&gt;It provides multiple APIs for different database operations. All APIs are async.&lt;/li&gt;
&lt;li&gt;It allows to store files in the form of blobs.&lt;/li&gt;
&lt;li&gt;It uses indexes to enable high performance search in the data.&lt;/li&gt;
&lt;li&gt;It is an alternative to WebSQL since WebSQL is now deprecated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, I am going to describe how we can do CRUD operation in indexeddb using jsstore. I am going to explain the example given by JsStore. So, if you want to have a look or want to use it. Here is the link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/Simple%20Example"&gt;https://github.com/ujjwalguptaofficial/JsStore/tree/master/examples/Simple%20Example&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Code
&lt;/h2&gt;

&lt;p&gt;First, create an HTML page, let's say index.html. Paste the below code inside index.html.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;  
&amp;lt;html lang="en"&amp;gt;  
&amp;lt;head&amp;gt;  
    &amp;lt;meta charset="UTF-8"&amp;gt;  
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;  
    &amp;lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&amp;gt;  
    &amp;lt;title&amp;gt;Crud Demo using jsstore&amp;lt;/title&amp;gt;  
&amp;lt;/head&amp;gt;  
&amp;lt;body&amp;gt;  

&amp;lt;/body&amp;gt;  
&amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;There are different ways to install JsStore. Check out the installation doc - &lt;a href="http://jsstore.net/tutorial/installation/"&gt;http://jsstore.net/tutorial/installation/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, I am going to download JsStore from the official repository. Download the repo from &lt;a href="https://github.com/ujjwalguptaofficial/JsStore"&gt;https://github.com/ujjwalguptaofficial/JsStore&lt;/a&gt; and unzip it. Now, open the folder and navigate to - dist folder. There, you will see many files. For this article, we need to copy two files - jsstore.min.js, jsstore.worker.min.js. &lt;/p&gt;

&lt;p&gt;Let's include the script in the HTML page, so now, our HTML becomes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;  
&amp;lt;html lang="en"&amp;gt;  
&amp;lt;head&amp;gt;  
    &amp;lt;meta charset="UTF-8"&amp;gt;  
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;  
    &amp;lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&amp;gt;  
    &amp;lt;title&amp;gt;Crud Demo using jsstore&amp;lt;/title&amp;gt;  
    &amp;lt;script src="jsstore.min.js"&amp;gt;&amp;lt;/script&amp;gt;  
&amp;lt;/head&amp;gt;  
&amp;lt;body&amp;gt;  
&amp;lt;h4&amp;gt;We have included JsStore in this html code.&amp;lt;/h4&amp;gt;  
&amp;lt;/body&amp;gt;  
&amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to initiate the JsStore in order to use. You can see that in line 13, I have created an instance of JsStore and stored it in a variable connection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;  
&amp;lt;html lang="en"&amp;gt;  
&amp;lt;head&amp;gt;  
    &amp;lt;meta charset="UTF-8"&amp;gt;  
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;  
    &amp;lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&amp;gt;  
    &amp;lt;title&amp;gt;Crud Demo using jsstore&amp;lt;/title&amp;gt;  
    &amp;lt;script src="jsstore.min.js"&amp;gt;&amp;lt;/script&amp;gt;  
&amp;lt;/head&amp;gt;  
&amp;lt;body&amp;gt;  
&amp;lt;h4&amp;gt;We have included JsStore in this html code.&amp;lt;/h4&amp;gt;  
&amp;lt;script&amp;gt;  
    var connection = new JsStore.Instance(new Worker('jsstore.worker.js'));  
&amp;lt;/script&amp;gt;  
&amp;lt;/body&amp;gt;  
&amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the variable - "connection" will be used to perform the database operation. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note :-&lt;/strong&gt; When you open the HTML file, you will see an error in the browser. That is because the worker is not accessible in the file protocol in some browsers, like Chrome. So, please use an HTTP Server for making it work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Database
&lt;/h3&gt;

&lt;p&gt;JsStore follows SQL approach to create a database - A database consists of tables and a table consists of columns. Let's see how to create a database schema in JsStore.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getDatabase() {  
    var tblStudent = {  
        name: "Student",  
        columns: [{  
                name: "Id",  
                primaryKey: true,  
                autoIncrement: true  
            },  
            {  
                name: "Name",  
                notNull: true,  
                dataType: "string"  
            },  
            {  
                name: "Gender",  
                dataType: "string",  
                default: 'male'  
            },  
            {  
                name: "Country",  
                notNull: true,  
                dataType: "string"  
            },  
            {  
                name: "City",  
                notNull: true  
            }  
        ]  
    }  
    var dataBase = {  
        name: "Students",  
        tables: [tblStudent]  
    }  
    return dataBase;  
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So what we have done -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created a function 'getDataBase' which will return the database schema.
Inside the function, we have created a table - tblStudent. tblStudent has a property Columns which contains a list of columns.&lt;/li&gt;
&lt;li&gt;A database is created with the name - "students" and tblStudent is passed to the database.&lt;/li&gt;
&lt;li&gt;The interesthing thing to note here is that - we are using options like : autoIncrement, default, notNull etc. which is not supported by default in indexedDb. But jsstore provides it.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, we have easily created the DB schema. But the database is not created yet.&lt;/p&gt;

&lt;p&gt;Now, let's create the DB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function initiateDb() {  
    var DbName = "Students";  
    connection.isDbExist(DbName).then(function(isExist) {  
        if (isExist) {  
            connection.openDb(DbName).then(function() {  
                console.log('db opened');  
            });  
            showTableData();  
        } else {  
            var DataBase = getDatabase();  
            connection.createDb(DataBase).then(function(tables) {  
                console.log(tables);  
            });  
        }  
    }).catch(function(err) {  
        console.log(err);  
        alert(err.message);  
    });  
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above function, when called, checks whether a database is created or not. If it is created, then we open the DB, otherwise create the DB. You can see we are calling getDatabase for getting db schema and then passing it to createDb API.&lt;/p&gt;

&lt;p&gt;Now, we need to call the initiateDb - we will call this in onload event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.onload = function() {  
    initiateDb();  
};  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the page is loaded  - the connection variable is initialized and db is created or opened. When you create db, JsStore also opens the db connection.&lt;/p&gt;

&lt;p&gt;So, now the connection variable knows that this is the database with which you want to perform the operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Insert Data
&lt;/h3&gt;

&lt;p&gt;JsStore provides Insert API for inserting the data. Check out insert doc. We have created a table ' Student ' which has the columns - Id, Name, Gender, Country, City.&lt;/p&gt;

&lt;p&gt;So a row (value) in the table student will be -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var value = {  
    Id: 1,  
    Name: 'durgesh',  
    Gender: 'male',  
    Country: 'India',  
    City: 'efr'  
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the Id is autoIncrement column, so we should not supply the value.&lt;/p&gt;

&lt;p&gt;Now, let's insert the above values in table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var value = {  
    // Id: 1,  
    Name: 'ffff',  
    Gender: 'male',  
    Country: 'USA',  
    City: 'efr'  
}  

connection.insert({  
    into: "Student",  // table name
    values: [value]  
}).then(function(rowsAdded) {  
    if (rowsAdded &amp;gt; 0) {  
        alert('Successfully added');  
    }  
}).catch(function(err) {  
    console.log(err);  
    alert('Error Occured while adding data')  
});  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, we are calling the Insert API, passing the table name, and values to insert. &lt;/p&gt;

&lt;h3&gt;
  
  
  Read Data
&lt;/h3&gt;

&lt;p&gt;JsStore has Select API for reading the data. Check out select docs for more info. So, let's say we want to read all the data in a table. The query will be like following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connection.select({  
    from: "Student"  
}).then(function(datas) {  
    console.log(datas);  
}).catch(function(err) {  
    console.log(err);  
}); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's say we want to select data from student whose id is 1. In that case we need to fliter row &amp;amp; JsStore provides - &lt;code&gt;where&lt;/code&gt; to filter data. So the query will be like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connection.select({  
    from: "Student",  
    where: {  
        Id: 1  
    }  
}).then(function(datas) {  
    console.log(datas);  
}).catch(function(err) {  
    console.log(err);  
});  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Update Data
&lt;/h3&gt;

&lt;p&gt;JStore provides Update API for updating the data. Check out update docs. So, let's say we want to update the student name whose id is 1, then the query will be like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connection.update({  
    in: "Student",  
    where: {  
        Id: 1  
    }  
}).then(function(rowsUpdated) {  
    console.log(rowsUpdated);  
}).catch(function(err) {  
    console.log(err);  
});  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Delete Data
&lt;/h3&gt;

&lt;p&gt;JsStore provides delete API for deleting the data. Check out update docs. Let's say we want to delete a student whose id is 2, then the query will be like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connection.remove({  
    from: "Student",  
    where: {  
        Id: 2  
    }  
}).then(function(rowsDeleted) {  
    console.log(rowsDeleted);  
}).catch(function(err) {  
    console.log(err);  
});  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;JsStore makes IndexedDB very simple and easy with its SQL like API. If you know SQL, then you already know the JsStore, you just have to start coding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://jsstore.net/tutorial/get-started/"&gt;http://jsstore.net/tutorial/get-started/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API"&gt;https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ujjwalguptaofficial/JsStore/blob/master/examples/Simple%20Example"&gt;https://github.com/ujjwalguptaofficial/JsStore/blob/master/examples/Simple%20Example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>jsstore</category>
      <category>indexeddb</category>
      <category>sql</category>
      <category>html</category>
    </item>
    <item>
      <title>Rest API In Node.js Using TypeScript And FortJs</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Tue, 26 Mar 2019 12:27:14 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/rest-api-in-nodejs-using-typescript-and-fortjs-5ff7</link>
      <guid>https://dev.to/ujjwal_kr_gupta/rest-api-in-nodejs-using-typescript-and-fortjs-5ff7</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Typescript is a great technology - which adds static typing to your javascript code, provides better intillisense support means faster development and much more. The popular client side framework Angular2 is an example of how typescript can be used to create a large project in less time. &lt;/p&gt;

&lt;p&gt;Now you must be wondering - can we use the power of typescript to create a nodejs server ? &lt;/p&gt;

&lt;p&gt;The answer is yes.&lt;/p&gt;

&lt;p&gt;In this article :- we will use &lt;a href="http://fortjs.info/"&gt;fortjs&lt;/a&gt; - a nodejs mvc framework fully compatible for typescript and next gen javascript - es6, es7.&lt;/p&gt;

&lt;h1&gt;
  
  
  Code
&lt;/h1&gt;

&lt;p&gt;The codebase of this article can be downloaded at - &lt;a href="https://github.com/ujjwalguptaofficial/fortjs/tree/master/example/rest/typescript"&gt;Example link on github&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;Clone or download the typescript starter project of fortjs — &lt;a href="https://github.com/ujjwalguptaofficial/fortjs-typescript-starter"&gt;https://github.com/ujjwalguptaofficial/fortjs-typescript-starter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After you have downloaded the project. Open the console and move to project directory and do the following steps,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run the command - npm install&lt;/li&gt;
&lt;li&gt;run the command - npm run start &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open the url - localhost:4000 in browser . You will see something like below,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IaQZCcTr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AaXOp3XaGdxml0HSB8v6XEQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IaQZCcTr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AaXOp3XaGdxml0HSB8v6XEQ.png" alt="Start Page" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  REST
&lt;/h2&gt;

&lt;p&gt;We are going to create the rest end point for entity user - which will perform the crud operations for user like adding user, deleting user, getting user, updating user.&lt;/p&gt;

&lt;p&gt;A/c to REST,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding user - should be done using http method "POST"&lt;/li&gt;
&lt;li&gt;Deleting user - should be done using  http method "REMOVE"&lt;/li&gt;
&lt;li&gt;Getting user - should be done using http method  "GET"&lt;/li&gt;
&lt;li&gt;Updating user - should be done using http method "PUT"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For creating an end point we need to create a controller. You can read about controller here - &lt;a href="http://fortjs.info/tutorial/controller/"&gt;http://fortjs.info/tutorial/controller/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;create a file user_controller.ts inside the contollers folder &amp;amp;  Copy the below code inside the file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Controller, textResult, DefaultWorker} from 'fortjs'  
export class UserController extends Controller {  
      @DefaultWorker()  
      async default() {  
          return textResult('you have successfully created a user controller');  
      }  
}

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

&lt;/div&gt;



&lt;p&gt;In the above code,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have created a class "UserController" which is extending another class Controller from fortjs.&lt;/li&gt;
&lt;li&gt;We have created a method default which is returning some result by using the method textResult from fortjs. textResult return http response with content-type 'text/plain'.&lt;/li&gt;
&lt;li&gt;We have used a decorator DefaultWorker from fortjs. A worker makes the method visible for http request so that it can be called using http request (no worker means it just a function which is only available for this class). A default worker is a worker which add the route "/" for target method. Please take a look at worker doc - &lt;a href="http://fortjs.info/tutorial/worker/"&gt;http://fortjs.info/tutorial/worker/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;We have created a controller but its still unknown by fortjs &amp;amp; in order to use this controller ,we need to add this to routes. Open routes.ts inside folder src and add UserController to routes.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have created a controller but its still unknown by fortjs &amp;amp; in order to use this controller ,we need to add this to routes. Open routes.ts inside folder src and add UserController to routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {DefaultController } from "./controllers/default_controller";  
import { UserController } from "./controllers/user_controller";  

export const routes = [{  
    path: "/*",  
    controller: DefaultController  
},{  
    path: "/user",   
    controller: UserController  
}] 

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

&lt;/div&gt;



&lt;p&gt;You can see we have added the path "/user" for UserController. It means when the path is "/user", UserController will be called. &lt;/p&gt;

&lt;p&gt;Now open the url — localhost:4000/user. You can see the output which is returned from default method inside “UserController”. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mYKwgoAv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/pmi5jrhhn8t6g0x098vt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mYKwgoAv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/pmi5jrhhn8t6g0x098vt.jpg" alt="Worker output" width="800" height="45"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One thing to notice here is that - codes looks very simple and nice. This is possible due to typescript &amp;amp; fortjs. And another fun is that - you will get intillisense support and this all make life easy for a developer :).&lt;/p&gt;

&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;Before moving further let’s write service code, which will help us to do crud operation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating models
&lt;/h3&gt;

&lt;p&gt;Create a folder “models” and then a file “user.ts” inside the folder. Paste the below code inside the file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Length, Contains, IsIn, IsEmail } from "class-validator";  

export class User {  
    id?: number;  

    @Length(5)  
    password?: string;  

    @Length(5)  
    name: string;  

    @IsIn(["male", "female"])  
    gender: string;  

    @Length(10, 100)  
    address: string;  

    @IsEmail()  
    emailId: string;  

    constructor(user: any) {  
       this.id = Number(user.id);  
       this.name = user.name;  
       this.gender = user.gender;  
       this.address = user.address;  
       this.emailId = user.emailId;  
       this.password = user.password;  
    }  
}

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

&lt;/div&gt;



&lt;p&gt;I am using a npm plugin - "class-validator" to validate the model. This model “user” will be used by service and controller for transfer of data.&lt;/p&gt;

&lt;p&gt;Create a folder “services” and then a file “ user_service.ts” inside the folder. Paste the below code inside the file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { User } from "../models/user";  

interface IStore {  
    users: User[];  
}  

const store: IStore = {  
    users: [{  
        id: 1,  
        name: "ujjwal gupta",  
        address: "Bengaluru india",  
        emailId: "admin-ujjwal@imail.com",  
        gender: "male",  
        password: "admin"  
    }]  
}  

export class UserService {

    getUsers() {  
        return store.users;  
    }

    addUser(user: User) {  
        const lastUser = store.users[store.users.length - 1];  
        user.id = lastUser == null ? 1 : lastUser.id + 1;  
        store.users.push(user);  
        return user;  
    } 

    updateUser(user: User) {  
        const existingUser = store.users.find(qry =&amp;gt; qry.id === user.id);  
        if (existingUser != null) {  
            existingUser.name = user.name;  
            existingUser.address = user.address;  
            existingUser.gender = user.gender;  
            existingUser.emailId = user.emailId;  
            return true;  
        }  
        return false;  
    }  

    getUser(id: number) {  
        return store.users.find(user =&amp;gt; user.id === id);  
    }  

    removeUser(id: number) {  
        const index = store.users.findIndex(user =&amp;gt; user.id === id);  
        store.users.splice(index, 1);  
    }  
} 

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

&lt;/div&gt;



&lt;p&gt;In the above code - we have created a dummy service. It contains a variable store which contains collection of users and the method inside the service do operation like — add, update, delete, get on that store.&lt;/p&gt;

&lt;h3&gt;
  
  
  GET
&lt;/h3&gt;

&lt;p&gt;We are going to create an end point for getting user.&lt;/p&gt;

&lt;p&gt;Let’s rename the default methods to “getUsers” which will return all users. Replace the code inside user_controller.ts by below code,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Controller, jsonResult, DefaultWorker} from 'fortjs'  

export class UserController extends Controller {  
    @DefaultWorker()  
    async getUsers() {  
       const service = new UserService();  
       return jsonResult(service.getUsers());  
    }  
} 

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

&lt;/div&gt;



&lt;p&gt;As you can see - we are using DefaultWorker since its make the method visible for http request and add route "/" with http method "GET". So all these things using one decorator.&lt;/p&gt;

&lt;p&gt;Let's try this using http client -&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PX4AAtd3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/kgaseie4gicyom5wd21f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PX4AAtd3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/kgaseie4gicyom5wd21f.png" alt="" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  POST
&lt;/h3&gt;

&lt;p&gt;We need to create a method which will add the user and only work for http method "POST". So now “UserController” looks like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Controller, jsonResult, DefaultWorker, HTTP_METHOD, HTTP_STATUS_CODE, Worker, Route } from 'fortjs'  

export class UserController extends Controller {  

      @DefaultWorker()  
      async getUsers() {  
          const service = new UserService();  
          return jsonResult(service.getUsers());  
      }  

      @Worker([HTTP_METHOD.Post])  
      @Route("/")  
      async addUser() {  
          const user = {  
              name: this.body.name,  
              gender: this.body.gender,  
              address: this.body.address,  
              emailId: this.body.emailId,  
              password: this.body.password  
          };  
          const service = new UserService();  
          const newUser = service.addUser(user);  
          return jsonResult(newUser, HTTP_STATUS_CODE.Created);  
      }  
}  

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

&lt;/div&gt;



&lt;p&gt;In the above code,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have created a method  "addUser" &amp;amp; added a decorator “Route” with parameter “/” which will add the route to method "addUser". This means - method “addUser” will be called when url will be :- localhost:4000/user/.&lt;/li&gt;
&lt;li&gt;In order to make this method visible for http request - we are using decorator “Worker”. The parameter “HTTP_METHOD.Post” makes the method only work when the request method will be POST.&lt;/li&gt;
&lt;li&gt;The method addUser -takes data from body (post data) and add the user to store by calling service. After the successful addition , it returns the added user with http code - 201 (Resource Created).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In summary - we have created a method "addUser" which sole purpose is to add user. It only works for http method post &amp;amp; route "/".&lt;/p&gt;

&lt;p&gt;You can test this by sending a post request to url - "localhost:4000/user/" with user model value as body of the request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kPR1U1Zt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qdrhwdnqpfp0kmv9qols.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kPR1U1Zt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qdrhwdnqpfp0kmv9qols.png" alt="" width="800" height="427"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So we have successfully created the POST end point. But one thing to note here is that - we are not doing any validation for the user. It might be that invalid data is supplied in post request.&lt;/p&gt;

&lt;p&gt;We can write code inside the method “addUser” to validate or write a seperate method inside a controller (like validateUser) for validation.&lt;/p&gt;

&lt;p&gt;Let's add the validation code,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Controller, jsonResult, DefaultWorker, HTTP_METHOD, HTTP_STATUS_CODE, Worker, Route } from 'fortjs'  
import { User } from '../models/user';  
import { validate } from "class-validator";   

export class UserController extends Controller {  

    @DefaultWorker()  
    async getUsers() {  
        const service = new UserService();  
        return jsonResult(service.getUsers());  
    }  

    @Worker([HTTP_METHOD.Post])  
    @Route("/")  
    async addUser() {  
        const user = {  
            name: this.body.name,  
            gender: this.body.gender,  
            address: this.body.address,  
            emailId: this.body.emailId,  
            password: this.body.password  
        }  
        as User;  
        const errorMsg = await this.validateUser(user);  
        if (errorMsg == null) {  
            const service = new UserService();  
            const newUser = service.addUser(user);  
            return jsonResult(newUser, HTTP_STATUS_CODE.Created);  
        } else {  
            return textResult(errMessage, HTTP_STATUS_CODE.BadRequest);  
        }  
    }  


    async validateUser(user: User) {  
        const errors = await validate('User', user);  
        if (errors.length === 0) {  
            return null;  
        } else {  
            const error = errors[0];  
            const constraint = Object.keys(error.constraints)[0];  
            const errMessage = error.constraints[constraint];  
            return errMessage;  
        }  
    }  
}  

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

&lt;/div&gt;



&lt;p&gt;Ok, so we have added the code to validation and it will work as expected but dont you think - our code looks little polluted and with the time it will look much pollute.&lt;/p&gt;

&lt;p&gt;FortJs provides &lt;a href="http://fortjs.info/tutorial/components/"&gt;components&lt;/a&gt; for validation &amp;amp; any extra work, so that your code looks much cleaner and easy to manage. &lt;/p&gt;

&lt;p&gt;FortJs says -  "A worker should only have code related to its main purpose and extra code should be written into components."&lt;/p&gt;

&lt;p&gt;There are three components of fortjs -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wall - Used at app level&lt;/li&gt;
&lt;li&gt;Shield - Used at controller level&lt;/li&gt;
&lt;li&gt;Guard - Used at worker level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's implement the above validation using components - since we are doing operation on worker, we need to use &lt;a href="http://fortjs.info/tutorial/guard/"&gt;Guard&lt;/a&gt; component.&lt;/p&gt;

&lt;h3&gt;
  
  
  Guard
&lt;/h3&gt;

&lt;p&gt;Create a folder “guards” and a file “ model_user_guard.ts” inside the folder. Write the below code inside the file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Guard, HttpResult, MIME_TYPE, HTTP_STATUS_CODE, textResult } from "fortjs";  
import { User } from "../models/user";  
import { validate } from "class-validator";  

export class ModelUserGuard extends Guard {  
    async check() {  
        const user: User = new User(this.body);  
        // here i am using a plugin to validate but you can write your own code too.   
        const errors = await validate('User', user);  
        if (errors.length === 0) {  
            // pass this to method, so that they dont need to parse again  
            this.data.user = user;  
            return null;  
        }  
        else {  
            const error = errors[0];  
            const constraint = Object.keys(error.constraints)[0];  
            const errMessage = error.constraints[constraint];  
            return textResult(errMessage, HTTP_STATUS_CODE.BadRequest);  
        }  
    }  
}  

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

&lt;/div&gt;



&lt;p&gt;In the above code,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We are writing code inside the check method which is part of guard lifecycle. We are validating the user inside it.&lt;/li&gt;
&lt;li&gt;If user is valid - then we are passing the user by using "data" property and returning null. Retuning null means guard has allowed this request and the worker should be called.&lt;/li&gt;
&lt;li&gt;If user is  not valid - we are returning the error message as text response with http code- "badrequest". We are retuning textResult which means the fortjs will consider this as response and worker wont be called.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we need to add this guard to method “addUser”,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Guards([ModelUserGuard])  
@Worker([HTTP_METHOD.Post])  
@Route("/")  
async addUser() {  
    const user: User = this.data.user;  
    const service = new UserService();  
    return jsonResult(service.addUser(user), HTTP_STATUS_CODE.Created);  
}  

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

&lt;/div&gt;



&lt;p&gt;In the above code,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have added the guard - “ModelUserGuard” using the decorator - Guards .&lt;/li&gt;
&lt;li&gt;With the guard in process, we dont need to parse the data from body anymore inside worker, we are reading it from this.data which we are passing from "ModelUserGuard" .&lt;/li&gt;
&lt;li&gt;The method “addUser” will be only called when Guard allow means if all data is valid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see that our worker method looks very light after using component.&lt;/p&gt;

&lt;h3&gt;
  
  
  PUT
&lt;/h3&gt;

&lt;p&gt;Now we need to create a method which will update the user and will only work for http method — “PUT”.&lt;/p&gt;

&lt;p&gt;Let’s add another method - “updateUser” with route “/” , guard — “ModelUserGuard” (for validation of user) and most important - worker with http method — “PUT”&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Worker([HTTP_METHOD.Put])  
@Guards([ModelUserGuard])  
@Route("/")  
async updateUser() {  
      const user: User = this.data.user;  
      const service = new UserService();  
      const userUpdated = service.updateUser(user);  
      if (userUpdated === true) {  
          return textResult("user updated");  
      }  
      else {  
          return textResult("invalid user");  
      }  
}

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

&lt;/div&gt;



&lt;p&gt;The above code is very simple, just calling the service code to update the user. But one important thing to notice is that we have reutilized the guard - “ModelUserGuard” and it makes our code very clean.&lt;/p&gt;

&lt;p&gt;So we are done with,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET - Returns all users&lt;/li&gt;
&lt;li&gt;POST - add users&lt;/li&gt;
&lt;li&gt;PUT - update user&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Currently the GET request returns all the users but what if we want to get only one user.&lt;/p&gt;

&lt;p&gt;Let’s see : how to do it,&lt;/p&gt;

&lt;p&gt;We have created a method “getUsers” for returning all users. Now let’s create another method “getUser” which will return only one user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Worker([HTTP_METHOD.Get])  
@Route("/{id}")  
async getUser() {  
      const userId = Number(this.param.id);  
      const service = new UserService();  
      const user = service.getUser(userId);  
      if (user == null) {  
          return textResult("invalid id");  
      }  
      return jsonResult(user);  
}  

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

&lt;/div&gt;



&lt;p&gt;In the above code - we are using a place holder in route. Now “getUser” will be called when url will be something like localhost:4000/user/1 The placeholder value is being consumed by using "this.param" .&lt;/p&gt;

&lt;h3&gt;
  
  
  REMOVE
&lt;/h3&gt;

&lt;p&gt;We will use the same concept as get,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Worker([HTTP_METHOD.Delete])  
@Route("/{id}")  
async removeUser() {  
      const userId = Number(this.param.id);  
      const service = new UserService();  
      const user = service.getUser(userId);  
      if (user != null) {  
          service.removeUser(userId);  
          return textResult("user deleted");  
      }  
      else {  
          return textResult("invalid user");  
      }  
}  

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

&lt;/div&gt;



&lt;p&gt;In the above code - we are just calling the service to remove the user after getting the id from route.&lt;/p&gt;

&lt;p&gt;Finally, we have successfully created a rest end point for user.&lt;/p&gt;

&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;TypeScript makes the development very faster with static typing &amp;amp; intillisense support. On the other hand : fortjs - help you to write the server code which is very clean, modular &amp;amp; secure. &lt;/p&gt;

&lt;h1&gt;
  
  
  Reference
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://fortjs.info/"&gt;http://fortjs.info/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/fortjs/rest-api-using-typescript-94004d9ae5e6"&gt;https://medium.com/fortjs/rest-api-using-typescript-94004d9ae5e6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>node</category>
      <category>fortjs</category>
      <category>rest</category>
    </item>
    <item>
      <title>Storing Data In Browser</title>
      <dc:creator>UJJWAL GUPTA</dc:creator>
      <pubDate>Tue, 19 Mar 2019 07:56:51 +0000</pubDate>
      <link>https://dev.to/ujjwal_kr_gupta/storing-data-in-browser-3ie9</link>
      <guid>https://dev.to/ujjwal_kr_gupta/storing-data-in-browser-3ie9</guid>
      <description>&lt;p&gt;With the advancement in web technology - now we can make an web application which will work almost like native application. We can store data , work offline , send push notification etc.&lt;/p&gt;

&lt;p&gt;In this article i will be talking only about storing data.&lt;/p&gt;

&lt;p&gt;There are multiple ways to store data in browser - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;localStorage&lt;/li&gt;
&lt;li&gt;sessionStorage&lt;/li&gt;
&lt;li&gt;WebSql&lt;/li&gt;
&lt;li&gt;IndexedDB&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  localStorage
&lt;/h3&gt;

&lt;p&gt;localStorage provides a way to save data in form of key and value. The key and value should be strictly string. &lt;/p&gt;

&lt;p&gt;e.g -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//save data - key : 'hello', value : 'world'
        localStorage.setItem('hello','world');

//get data - you can get data by using key.

        localStorage.getItem('hello')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more about localStorage : visit this link - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  sessionStorage
&lt;/h3&gt;

&lt;p&gt;sessionStorage is similar to localStorage but data stored in localStorage has no expiration but data store in sessionStorage is expired as long as the browser session ends.&lt;/p&gt;

&lt;p&gt;The browser session ends when the tab is closed.&lt;/p&gt;

&lt;p&gt;e.g -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//save data - key : 'hello', value : 'world'
        sessionStorage .setItem('hello','world');

//get data - you can get data by using key.

        sessionStorage .getItem('hello')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more about localStorage : visit this link - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  WebSql
&lt;/h3&gt;

&lt;p&gt;WebSql provides a way to store data in forms of database which is relational database management system. So you can write sql query to do any operation.&lt;/p&gt;

&lt;p&gt;Sounds great right ?&lt;/p&gt;

&lt;p&gt;But due to the many problems WebSql is deprecated although chrome only supports WebSql.&lt;/p&gt;

&lt;p&gt;The problems were - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WebSql is synchronous which means while querying it may freeze ui untill the result is evaluated.&lt;/li&gt;
&lt;li&gt;It supported only basic data type while users wanted to store blob, binary type etc.&lt;/li&gt;
&lt;li&gt;The size of the WebSql is limited and very low which depends from browser to browser.&lt;/li&gt;
&lt;li&gt;The query takes more time when data is in large amount.&lt;/li&gt;
&lt;li&gt;WebSql is not transaction based.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The main purpose of WebSql was to provide a way to store data in terms of database. It was able to do the work but due to these problems it was not upto the mark.&lt;/p&gt;

&lt;p&gt;Since it is deprecated i am not providing any example.Neither i will suggest to use it.&lt;/p&gt;

&lt;h3&gt;
  
  
  IndexedDB
&lt;/h3&gt;

&lt;p&gt;IndexedDB is next version of WebSql which solves all the problems which was in WebSql.&lt;/p&gt;

&lt;p&gt;Lets see the feature of indexedDB - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It is asychronous which means it wont freeze ui - no matter how big query is runing.&lt;/li&gt;
&lt;li&gt;It is NoSql db and supports advanced data type likes - array, blob etc.&lt;/li&gt;
&lt;li&gt;It allows you to indexed data and due to this it is very fast.&lt;/li&gt;
&lt;li&gt;It is transaction based.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So using indexeddb - you can store large amount of data in forms of object (since it is NoSql). But with the more features there comes a complexity : the same is with the IndexedDB.&lt;/p&gt;

&lt;p&gt;IndexedDB provides many apis for every need. It provides event based api which makes it hard to learn and think in terms of storage.&lt;/p&gt;

&lt;p&gt;For more about how to use indexedd, please read this article - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB"&gt;https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the end - you will find this complex. But worry not, there are some library available to make this easy.&lt;/p&gt;

&lt;p&gt;Some of them are - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JsStore - &lt;a href="https://github.com/ujjwalguptaofficial/JsStore"&gt;https://github.com/ujjwalguptaofficial/JsStore&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dexie - &lt;a href="https://github.com/dfahlander/Dexie.js/"&gt;https://github.com/dfahlander/Dexie.js/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  References
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB"&gt;https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jsstore.net/"&gt;http://jsstore.net/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage"&gt;https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>indexeddb</category>
      <category>browser</category>
      <category>storage</category>
      <category>websql</category>
    </item>
  </channel>
</rss>
