<?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: Ognjen Gatalo</title>
    <description>The latest articles on Forem by Ognjen Gatalo (@ognjengt).</description>
    <link>https://forem.com/ognjengt</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%2F15810%2Fdf507339-f7ae-45de-8b41-2701d51c0dd5.jpg</url>
      <title>Forem: Ognjen Gatalo</title>
      <link>https://forem.com/ognjengt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ognjengt"/>
    <language>en</language>
    <item>
      <title>Announcing Capsulelink: A tool for grouping, saving, and sending links as one</title>
      <dc:creator>Ognjen Gatalo</dc:creator>
      <pubDate>Fri, 06 Apr 2018 09:29:15 +0000</pubDate>
      <link>https://forem.com/ognjengt/announcing-capsulelink-a-tool-for-grouping-saving-and-sending-links-as-one-1l6f</link>
      <guid>https://forem.com/ognjengt/announcing-capsulelink-a-tool-for-grouping-saving-and-sending-links-as-one-1l6f</guid>
      <description>&lt;p&gt;With the beginning of this year, I set my new years resolution on shipping/ deploying more products. Even if I am not so satisfied how they ended up, I will ship the end result, and see the engagement I get from users. So to get right on with the topic.&lt;/p&gt;

&lt;p&gt;I published &lt;a href="http://capsulelink.com/"&gt;http://capsulelink.com/&lt;/a&gt; little more than a week ago. It is a simple tool that lets you save multiple links into one, and ease you the pain of sending many links to many other people. Instead, you just send them one link, and it will contain all of the others.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MAh9rMbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jgjddspz88hguyf53yiq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MAh9rMbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jgjddspz88hguyf53yiq.png" alt="First version of capsulelink.com"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At first, it was a barebone product, with limited features. But I'm constantly adding more useful stuff to it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Features
&lt;/h1&gt;

&lt;p&gt;Links created by anonymous users (users who are not logged in) expire after 48h, while if you have an account, your links won't ever expire. So it is a good and quick way of saving some pages you are currently researching, and access them at any time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IcMbEf-6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tb9sxjo9wcvtlj6eemxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IcMbEf-6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tb9sxjo9wcvtlj6eemxl.png" alt="Group link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, there are private links for registered users. Private links are only visible to the user who created them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qM3m0Xzb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/esdv1bsl00k144qkrho8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qM3m0Xzb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/esdv1bsl00k144qkrho8.png" alt="Private links"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recently I saw the direction where this app was going, so I added the upvoting feature, and trending page. This way, other people can discover useful links, that are legitimately useful.&lt;/p&gt;

&lt;p&gt;Not to lie, I discovered some pretty good tools myself, that other people posted, including websites, tools, articles and much more.&lt;/p&gt;

&lt;p&gt;Then I saw that sometimes it is a pain to always have to switch to capsulelink.com to paste the URL you want to save. So I created the chrome extension, and it turned out to be even easier to use than the website itself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ju2vUUC6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ecxtgrzd5zyk5smn0krp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ju2vUUC6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ecxtgrzd5zyk5smn0krp.png" alt="Chrome extension in action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find it here: &lt;a href="https://chrome.google.com/webstore/detail/capsulelink/khgappllikejideefljdafjbbnnclbno"&gt;https://chrome.google.com/webstore/detail/capsulelink/khgappllikejideefljdafjbbnnclbno&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With one click you can add websites, and then when you added the pages you desired, with just one click you create the group link, and it is saved on the server.&lt;/p&gt;

&lt;p&gt;Although, currently the chrome extension only creates anonymous links and does not support login feature, but I'm working on that and deploying it asap. Then you will be able to directly save to your profile.&lt;/p&gt;

&lt;h1&gt;
  
  
  Thank you for reading
&lt;/h1&gt;

&lt;p&gt;I would love to hear some real user feedback and to have a chat with anyone interested. I'm open to suggestions and critics at any time. Let me know what you think I should improve in the comments, or message me on Twitter: &lt;a href="https://twitter.com/ognjengt"&gt;https://twitter.com/ognjengt&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>projects</category>
    </item>
    <item>
      <title>Creating node api’s became a lot easier. Introduction to build-express-api</title>
      <dc:creator>Ognjen Gatalo</dc:creator>
      <pubDate>Wed, 03 Jan 2018 18:49:47 +0000</pubDate>
      <link>https://forem.com/ognjengt/creating-node-apis-became-a-lot-easier-introduction-to-build-express-api-292e</link>
      <guid>https://forem.com/ognjengt/creating-node-apis-became-a-lot-easier-introduction-to-build-express-api-292e</guid>
      <description>&lt;p&gt;In this article, I would like to share, something I’ve been working on since mid November. I personally am most proud of this project than any other project I’ve worked on in my small software development career.&lt;/p&gt;

&lt;p&gt;I’m talking about a tool I’ve built called “build-express-api”. A command-line interface (CLI) that helps developers build node express api in a blink of an eye.&lt;/p&gt;

&lt;p&gt;I came to this idea, realizing that when I’m creating a backend with node, I don’t have a quick and easy way to create models and controllers.&lt;/p&gt;

&lt;p&gt;I would always need to copy an existing code, create the file manually, require the script in the server.js, install all of the needed dependencies, and so on…&lt;/p&gt;

&lt;p&gt;So I wanted to make my development workflow easier.&lt;/p&gt;

&lt;p&gt;For some time now I was interested in creating a npm package, and this seemed like a perfect opportunity. So I watched a few tutorials, googled a bit, and was ready to go.&lt;/p&gt;

&lt;p&gt;I didn’t have all of the features written down, I just started building, and one thing led to another.&lt;/p&gt;

&lt;p&gt;If you want to check out the package right now, it is available here: &lt;a href="https://www.npmjs.com/package/build-express-api"&gt;https://www.npmjs.com/package/build-express-api&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The start
&lt;/h1&gt;

&lt;p&gt;I’ve really liked the express CLI itself, and the way it initializes the whole folder structure just by typing “express” in terminal. I wanted something similar, so the first feature I created was “init”.&lt;/p&gt;

&lt;p&gt;By typing “build-express-api init” the program initialized the application structure.&lt;/p&gt;

&lt;p&gt;Also, the program creates beaConfig.json file, where the developer can configure the routes to the models and controllers folders, as well as the location of server.js file.&lt;/p&gt;

&lt;p&gt;If you already have a project in development and would like to use this tool on that project, by executing “build-express-api create-config” the program creates only beaConfig.json file in the root project directory, there you can just configure the locations, and start building an api.&lt;/p&gt;

&lt;p&gt;Off to a good start. Now the real work was about to kick in.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating controllers and models
&lt;/h1&gt;

&lt;p&gt;I needed a quick way to create controllers/routes and models, so the next features I implemented were “create-controller” and “create-model”.&lt;/p&gt;

&lt;p&gt;I wanted to make the CLI interactive, to lead the developer through the process of creating.&lt;/p&gt;

&lt;p&gt;So instead of typing one large command in one line, the application prompts the developer through series of questions, like: What’s the controller's name? Would you like to add routes to this controller? and so on…&lt;/p&gt;

&lt;p&gt;At the end, these commands look something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vUT-F8Lt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l82ejv1lct90ipsawssl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vUT-F8Lt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l82ejv1lct90ipsawssl.png" alt="creating a plain controller"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By typing “build-express-api create-controller” or “build-express-api cc” for short, a new controller would be created in controllers folder, with all of the required dependencies.&lt;/p&gt;

&lt;p&gt;After implementing this feature, I’ve really seen the potential this tool had, and how it could ease the developer's creation process.&lt;/p&gt;

&lt;p&gt;When creating a new controller, the developer is given 2 options, to create a plain controller, with 4 routes (GET, POST, PUT, DELETE) or to enter custom routes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U-xd-gpV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/btge6jtz44lgcw7cb0gq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U-xd-gpV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/btge6jtz44lgcw7cb0gq.png" alt="creating a controller with routes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After selecting the custom routes from the menu, the developer can type the routes he needs, and they will be created.&lt;/p&gt;

&lt;p&gt;I’ve done the same thing with models, by typing “build-express-api create-model” or “build-express-api cm” for short.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jBfJ8PO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/grdc9ph6y64b41x7ildq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jBfJ8PO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/grdc9ph6y64b41x7ildq.png" alt="creating a model"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The controller file looks something like this ( this is the example code when building plain controller)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kxgcZPod--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kndoctb28vz3zwqo0cc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kxgcZPod--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kndoctb28vz3zwqo0cc6.png" alt="authenticationController.js example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the model file looks something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JwFHp1pt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hleq1avcqs4k5qculfb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JwFHp1pt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hleq1avcqs4k5qculfb5.png" alt="User.js example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Automatically requiring the files in server.js/app.js
&lt;/h1&gt;

&lt;p&gt;I wanted to automate the process even more, so after the controllers are created, the tool automatically requires them in the main server file.&lt;/p&gt;

&lt;p&gt;This sped up the process significantly. The developer doesn’t need to overthink did he include the routes in server file, he could just create a controller, run “npm start” and see the working api. Which is the main point why I built this tool.&lt;/p&gt;

&lt;h1&gt;
  
  
  Adding routes to existing controllers
&lt;/h1&gt;

&lt;p&gt;Another feature is that developer can add new routes to existing controllers.&lt;/p&gt;

&lt;p&gt;By running “build-express-api add-routes ”, the developer is prompted with the message to add the routes in strict JSON format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t8vBiEbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ma4ond74zey0rwkqmys2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t8vBiEbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ma4ond74zey0rwkqmys2.png" alt="Adding routes (getToken and generateToken) to authenticationController"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After this, authenticationController is richer for 2 new routes.&lt;/p&gt;

&lt;h1&gt;
  
  
  Adding tests and continuous integration
&lt;/h1&gt;

&lt;p&gt;I’ve realized that this module, must gain trust by other developers, so I had to add tests to it. I haven’t really tested any javascript application before, so I decided to go with mocha and chai because I saw they are the popular test frameworks.&lt;/p&gt;

&lt;p&gt;I thought this would take some time to figure out, but actually, it didn’t, and it helped me A LOT.&lt;/p&gt;

&lt;p&gt;Working on this project I found the test-driven development approach and saw how powerful it actually is. I am now confident when deploying. If all of my tests pass, there is no need to worry about errors.&lt;/p&gt;

&lt;p&gt;Of course, this module is not perfect, and there is always something to improve.&lt;/p&gt;

&lt;p&gt;Also, I tried out TravisCI for the first time and was happy as a little kid when I saw the green build:passing badge.&lt;/p&gt;

&lt;p&gt;I immediately added the badge to the github repo, so the module would gain trust, seeing that all the tests are passing.&lt;/p&gt;

&lt;p&gt;With Travis, I don’t need to worry if the module will work on other machines.&lt;/p&gt;

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

&lt;p&gt;Overall, building this module, was a very productive experience, I’ve learned about things that I had interest in, and the things that I should learn as a developer.&lt;/p&gt;

&lt;p&gt;Github repo to this module can be found here: &lt;a href="https://github.com/ognjengt/build-express-api"&gt;https://github.com/ognjengt/build-express-api&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to create pull requests, post issues you encounter, and star the repo if you think this could be something useful for you. There are still things I need to fix, and I’m looking forward to improving this module.&lt;/p&gt;

&lt;p&gt;Also be sure to go through the readme.&lt;/p&gt;

&lt;p&gt;Plan for the future is to create a full platform that would support a variety of languages and frameworks and automate the API creation process.&lt;/p&gt;

&lt;p&gt;You can find me on twitter too: &lt;a href="https://twitter.com/ognjengt"&gt;https://twitter.com/ognjengt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to give me your recommendations and opinions, I would love to hear them!&lt;/p&gt;

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