<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Taufan Fadhilah Iskandar on Medium]]></title>
        <description><![CDATA[Stories by Taufan Fadhilah Iskandar on Medium]]></description>
        <link>https://medium.com/@taufanfadhilahiskandar?source=rss-39f1ec8edc9d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mVaItjxHvShd7LT4lq3IOA.jpeg</url>
            <title>Stories by Taufan Fadhilah Iskandar on Medium</title>
            <link>https://medium.com/@taufanfadhilahiskandar?source=rss-39f1ec8edc9d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:55:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@taufanfadhilahiskandar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Basic CRUD in Golang, Learned From Unicorn’s Engineer]]></title>
            <link>https://medium.com/geekculture/basic-crud-in-golang-learned-from-unicorns-engineer-586b89111592?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/586b89111592</guid>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Mon, 17 May 2021 07:29:38 GMT</pubDate>
            <atom:updated>2021-05-18T20:35:03.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YeVDo3ni0MVKNgZG.png" /><figcaption>just a cute illustration</figcaption></figure><p>I have been working for many projects and for backend tech i was used PHP for almost 10 years, and this last 3 years I also trying Node JS as one of my backend stack. And now i want to focus using <a href="https://golang.org/">Golang</a> since Golang have a good track record and many startups are using this as their backend stack.</p><p>To help me going deeper in Golang, i decided to bought a Golang course and luckily my mentor is an engineer in one of unicorn in Indonesia. Personally, first time when i created a simple project using Golang i felt this stack is so strict and complicated. But after knowing the result from memory and speed, i was impressed with this language. So in this article i will write a tutorial to make a CRUD API using Golang, it might be a long tutorial because i want to write step by step.</p><h3>Installation</h3><p><strong>Firstly</strong>, you need to make a empty folder (let’s say the folder name is <strong>go-basic-crud</strong>) then go to that folder.<br>next, in terminal you need to set initial mod by using this command</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dgo%252520mod%252520init%252520go-basic-crud&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dgo%25252520mod%25252520init%25252520go-basic-crud&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/40ae719a1e26ad921e75980cc55eac13/href">https://medium.com/media/40ae719a1e26ad921e75980cc55eac13/href</a></iframe><p>After that, we need to install <a href="https://github.com/gin-gonic/gin"><strong>Gin Gonic</strong></a> which make our Golang can be accessed using request. Just type this command in terminal</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dgo%252520get%252520-u%252520github.com%25252Fgin-gonic%25252Fgin&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dgo%25252520get%25252520-u%25252520github.com%2525252Fgin-gonic%2525252Fgin&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/47b6e6af3574bd0ad063647bcc010b77/href">https://medium.com/media/47b6e6af3574bd0ad063647bcc010b77/href</a></iframe><p>Last step of installation is we need to create a <strong>main.go</strong> file. Inside that file, call gin-gonic and create a router</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*_Bp2H3kt0KQVO_IV8MxLSg.png" /><figcaption>main.go</figcaption></figure><p>Finally, we can test our installation by running the project. Use <strong>go run main.go</strong> to run, and when you access <strong>/ping</strong> from browser, a json response will be show.</p><h3><strong>Insert to DB</strong></h3><p>Before going to code, don’t forget to create a new database (let’s say the name is <strong>go-basic</strong>). We’re not going to create the table because we will use auto migration to create the tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q41xAGW4ipWy0y_NSkuDvw.png" /><figcaption>task’s table schema</figcaption></figure><p>Next, we will make some files and folders to maintain our code like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*2gA5po_MXopFNKSd6dfzmg.png" /><figcaption>folder structure</figcaption></figure><p>First, we make a <strong>entity.go</strong> inside task folder. This file purposely to define our table schema, so this file will be used to auto migration and ORM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4mLpHSqrE7qv-b2JGJo8Q.png" /><figcaption>entity.go</figcaption></figure><p>second file we need to define input as struct inside <strong>input.go</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRsyeqt6LyieBd88XwKnfg.png" /><figcaption>input.go</figcaption></figure><p>third file we need to make is repository.go which be used to do manipulation our database records. Don’t forget to install <a href="https://gorm.io/"><strong>GORM</strong></a> first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWRo90RvbryWnY9ZzxVIwA.png" /><figcaption>repository.go</figcaption></figure><p>next file is <strong>service.go</strong>, this file purposes to call the repository functions and functions inside service file might be called to other domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omYiJXiilCGZ5IVUOxYOPg.png" /><figcaption>service.go</figcaption></figure><p>last file is <strong>task.go</strong> inside handler folder. This file purposes to let router call the function and using service functions, it’s kinda of controller file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSz9T12QhdYx-9M0OSahjw.png" /><figcaption>task.go</figcaption></figure><p>Last step of this section are define our database connection, do auto migration, define repository, service, and handler and then create routing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1isQuVWyC7HcPtvwmJEauw.png" /><figcaption>main.go</figcaption></figure><p>after restarting our server, you can try to hit /task to get all records from task table.</p><h3>Get All Data from DB</h3><p>Actually we already do a long step for storing data, now we will continue to get the data.</p><p>First, we need to create a new function in <strong>repository.go</strong> to get all data from DB. Let’s give the function name <strong>SelectAll()</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8MfHv5UxC2OKp6Rxnk4bw.png" /><figcaption>repository.go</figcaption></figure><p>To call the function in Repository, we will call it in <strong>service.go</strong> file. Let’s create a new function with name <strong>Index()</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UegdkM4hvOdPboRiljj3Iw.png" /><figcaption>service.go</figcaption></figure><p>Next, call service’s function inside <strong>task.go</strong> in handler. Let’s create new function with name <strong>Index</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPx_gaGOpLC0zhFLqL6Gyg.png" /><figcaption>task.go</figcaption></figure><p>Last touch is, we just need to register new route in <strong>main.go</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKYYFRGtuln-EZ9vehmV6Q.png" /><figcaption>main.go</figcaption></figure><h3>Get Data by ID</h3><p>For creating this flow, is not really much change we will do. So let’s start.</p><p>First, we need a new struct in <strong>input.go</strong> to get id from url. Just call <strong>InputTaskDetail</strong> struct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vdmRJeu41wE-o2QG1R_ew.png" /><figcaption>input.go</figcaption></figure><p>Next, of course we need to create a new function inside <strong>repository.go</strong>. Just call <strong>SelectById</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-8QaO0NQ7jjoKjCt4m7xQ.png" /><figcaption>repository.go</figcaption></figure><p>Call the new function in <strong>service.go</strong>. Create new function with name <strong>SelectById</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-8QaO0NQ7jjoKjCt4m7xQ.png" /><figcaption>service.go</figcaption></figure><p>Call new service’s function in handler, so we can create a new route. Let’s make it with name <strong>Show</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WfVK8UAA9GdUya5Jp-z9Q.png" /><figcaption>task.go</figcaption></figure><p>Last touch is make a new route in <strong>main.go</strong> so we can get record by ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9PhM35AcYtG4bzbrSFvtA.png" /><figcaption>main.go</figcaption></figure><p>Restart your server, and access by using /task/:id (e.g localhost:8080/api/task/1) to get the data.</p><h3>Update the Data</h3><p>Next section is updating the data because it’s related with select data by ID.</p><p>Create a new function in <strong>repository.go</strong> with name <strong>Update</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4zT_BYHBNa_W8RV8vQJzhw.png" /><figcaption>repository.go</figcaption></figure><p>Move to <strong>service.go</strong> file, create a new function with name <strong>Update</strong> as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Bx-kY2Thc2BYmu_JUX1cw.png" /><figcaption>service.go</figcaption></figure><p>And then create a new function in our handler to allow route updating the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-39uY2SScHNd8xQ84xKgw.png" /><figcaption>task.go</figcaption></figure><p>Last touch, register new route in <strong>main.go</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsfIMLblZecKCB3odQd5dg.png" /><figcaption>main.go</figcaption></figure><p>To test our new route, don’t forget to restart the server first.</p><h3>Delete Data by ID</h3><p>actually the step is not really different with updating data, just create a new function in repository, service, handler and register the new route.</p><p>In <strong>repository.go</strong>, create a new function with name <strong>Destroy</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OK2dJkdXrOtsx7qiFRo5ag.png" /><figcaption>repository.go</figcaption></figure><p>also in <strong>service.go</strong>, create a new function with name <strong>Destroy</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uu-aOh7WJCzfPGXdMNLdfA.png" /><figcaption>service.go</figcaption></figure><p>inside handler file, create a new function as well called <strong>Destroy</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctTiesMH3bEEMnXlZ3ygUQ.png" /><figcaption>service.go</figcaption></figure><p>Last touch is registering a new route as usual in <strong>main.go</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aUVw7omFMwCqFw4sS1iLtw.png" /><figcaption>main.go</figcaption></figure><p>Restart your server and hit the new API we just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ck-mgOkywViHkZx2.png" /><figcaption>ganbatte!!</figcaption></figure><h3><strong>Conclusion</strong></h3><p>For me who first time create CRUD API with Golang was felt so strict and complicated, we need to create condition to handle <strong><em>err</em></strong>. But this language is very good, we can do more logic and concurrency requests at the same time. And also we can use compiled project in any OS.</p><p>I have provide my <a href="https://github.com/taufanfadhilah/GO-basic-crud"><strong>Github</strong></a> if you want to clone the project. Please feel free to message me maybe you have question or wanna do a collaboration, just go through my <a href="https://www.linkedin.com/in/taufanfadhilahiskandar/"><strong>LinkedIn</strong></a>. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=586b89111592" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/basic-crud-in-golang-learned-from-unicorns-engineer-586b89111592">Basic CRUD in Golang, Learned From Unicorn’s Engineer</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using JWT as Authentication in API Gateway]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/using-jwt-as-authentication-in-api-gateway-638216d61cbd?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/638216d61cbd</guid>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Fri, 04 Dec 2020 09:33:22 GMT</pubDate>
            <atom:updated>2020-12-04T09:33:22.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9dyPqEwpwSB2awnp.png" /><figcaption>JWT logo</figcaption></figure><p>This is the last part of our journey to <a href="https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15">build simple microservice</a>. Now we will give an authentication module to make our APIs secure.</p><h3>What is JSON Web Token?</h3><p>JSON Web Token (JWT) is an open standard (<a href="https://tools.ietf.org/html/rfc7519">RFC 7519</a>) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the <strong>HMAC</strong> algorithm) or a public/private key pair using <strong>RSA</strong> or <strong>ECDSA</strong>.</p><h3>When should you use JSON Web Tokens?</h3><p>Here are some scenarios where JSON Web Tokens are useful:</p><ul><li><strong>Authorization</strong>: This is the most common scenario for using JWT. Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used across different domains.</li><li><strong>Information Exchange</strong>: JSON Web Tokens are a good way of securely transmitting information between parties. Because JWTs can be signed — for example, using public/private key pairs — you can be sure the senders are who they say they are. Additionally, as the signature is calculated using the header and the payload, you can also verify that the content hasn’t been tampered with.</li></ul><p>You can read more about <a href="https://jwt.io/introduction/">JWT</a>, next what we will do is:<br>- Setup .env<br>- Create middleware<br>- Add middleware to route<br>- Run in Postman</p><h3>Setup .env</h3><p>The important variables for me is the Token Secret and Token Lifetime, in this tutorial we only use access token. But you can add the refresh token as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*K4_4lW7aF4GbaCS072bV_g.png" /><figcaption>.env JWT variables</figcaption></figure><h3>Create Middleware</h3><p>Middleware is a request gateway, it will make our request allowed to the controller or not. So we will create veriftToken.js file inside middleware folder. Of course don’t forget to install <a href="https://www.npmjs.com/package/jsonwebtoken">JWT</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*Fd8TIse7WEV4l5ddvjunzw.png" /><figcaption>middleware folder</figcaption></figure><p>in verifyToken.js, we will check the token from Authentication header is valid or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q6B64zkt47MoU0Q6nESTHQ.png" /><figcaption>verifyToken.js</figcaption></figure><h3>Add Middleware to Routes</h3><p>To use the middleware in route is very easy. We only need to require the verifyToken.js, and put it in second params of routes. Example, this route is required header named Authentication with JWT token. If token is valid, the client will get detail of user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbIl71jQttU4lwMXOlYxow.png" /><figcaption>users.js routes</figcaption></figure><h3>Run in Postman</h3><p>In this project, we can get the JWT token by login api.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cFSFUGgPaOY5uH1Et1vh-g.png" /><figcaption>login api</figcaption></figure><p>And then we will try to access routes with middleware, it should be can not accessed without token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-rZnWHBVhFnLTAYAqplAQ.png" /><figcaption>error token</figcaption></figure><p>Next, we will try access that route with token. It should be return success API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sRd77EzLxYh6Y1i4E62k6Q.png" /><figcaption>success reponse</figcaption></figure><p>So that is how to implement JWT in API Gateway Microservice. We can secure the private API by the JWT token. For you that need the project can visit my <a href="https://github.com/taufanfadhilah/microservice-gateway-api">Github</a>. And of course can follow previous step start from <a href="https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=638216d61cbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build API Gateway with Nodejs for Microservice]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/build-api-gateway-with-nodejs-for-microservice-e78f667ba934?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e78f667ba934</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Fri, 04 Dec 2020 08:44:07 GMT</pubDate>
            <atom:updated>2020-12-04T08:44:07.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*gyLfI0OcCVN8RSWF.png" /><figcaption>illustration for api gateway</figcaption></figure><p>This article is about how to build a API Gateway for our <a href="https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15">microservice</a>. Previously we already build a <a href="https://taufanfadhilahiskandar.medium.com/simple-lumen-api-for-microservice-de47e4b4d31c">Property Service</a> and <a href="https://taufanfadhilahiskandar.medium.com/build-simple-nodejs-api-for-microservice-7da5bf207630">User Service</a>, so you can follow from beginning.</p><h4>What is an API Gateway?</h4><p>An API gateway takes all API calls from clients, then routes them to the appropriate microservice with request routing, composition, and protocol translation. Typically it handles a request by invoking multiple microservices and aggregating the results, to determine the best path. It can translate between web protocols and web‑unfriendly protocols that are used internally.<br>In this article, our API gateway act is be a gateway from client to access our services. And also next article we will learn how to set the authentication in our API gateway and set the middleware as well.</p><p>Next, we will start to build an API Gateway with Nodejs with this following steps:<br>- Create Express project<br>- Setup .env<br>- Create apiAdapter<br>- Create service handler<br>- Register to routes<br>- Run in Postman</p><h3>Create Express Project</h3><p>For create a project, you need install Nodejs and Express in your PC. Then, you can use this command</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dexpress%252520--no-view%252520user-api&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%25252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dexpress%25252520--no-view%25252520user-api&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c28f5152102706b6afa38df9e9d87e5a/href">https://medium.com/media/c28f5152102706b6afa38df9e9d87e5a/href</a></iframe><h3>Setup .env</h3><p>Create a .env and then we can set url services. Don’t forget to add <a href="https://www.npmjs.com/package/dotenv">dotenv</a> to make our project can read the process env.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*Cz1p9c3s1yrux5-R6L-frw.png" /><figcaption>.env file</figcaption></figure><h3>Create apiAdapter</h3><p>Usually i create apiAdapter inside the routes folder, because we also will setup handler for other services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*3Zb99gtpn0uROF1Dr5no9Q.png" /><figcaption>inside routes folder</figcaption></figure><p>The apiAdapter is an utils for our gateway can access with services. For Http Request we will using <a href="https://www.npmjs.com/package/axios">axios</a>. We create axios instance with timeout, so we can use this instace inside another files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vfSYuYhjnPHVh0UIStYoug.png" /><figcaption>apiAdapter.js</figcaption></figure><h3>Create Service Handler</h3><p>To create a maintainable controllers, i create a folder for one service. So when we have new API for that service, it will easy to update the gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*y3irkuVmyYHPtVK1Kmm-7w.png" /><figcaption>service handler folder</figcaption></figure><p>now, we will create an API for get all house which from Property Service. First we need to import apiAdapter and property service url. Next we pass request to the Property Service by our apiAdapter. <strong>One important thing</strong>, we must set for fail scenario with set the catch with some condition such as service unavailable and error response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fUk2q5_o2PxaYVoMNG6i2Q.png" /><figcaption>getAll.js</figcaption></figure><p>Every service will have an index.js as parent file, this file just contain services we have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*D0BaLGqyxWsucuRqJtI46w.png" /><figcaption>index.js</figcaption></figure><h3>Register to Routes</h3><p>To make the controller able to use, we need to register into the routes file. Routes file also i split by its service. Here is the house routes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrfJhwLfRHKNTMBzMYAhwQ.png" /><figcaption>house.js</figcaption></figure><p>Last, we can register the spesific routes into app.js like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9pr9hB8PQs_f363ppz9eA.png" /><figcaption>app.js</figcaption></figure><h3>Run in Postman</h3><p>To make sure our API was running correctly, we can test it in Postman</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2vaFsvsjYZzc7doodF4xw.png" /><figcaption>run in postman</figcaption></figure><p>From the steps above we already build API Gateway with Express Nodejs. You can clone my project from my <a href="https://github.com/taufanfadhilah/microservice-gateway-api">Github</a> as well. Next, we continue to setup JWT in this Gateway API. See you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e78f667ba934" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Simple Nodejs API for Microservice]]></title>
            <link>https://medium.com/swlh/build-simple-nodejs-api-for-microservice-7da5bf207630?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7da5bf207630</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 09:30:10 GMT</pubDate>
            <atom:updated>2020-12-13T20:55:45.337Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*gj_vIxIgqtPCryFK.png" /><figcaption>Express Nodejs</figcaption></figure><p>In this article we are gonna build Nodejs project for API and next we will integrate services with a gateway, so that is microservice.</p><p>This project we will build <strong>user service</strong> that focus for user management such as login, register and detail user. Steps to build user service are:<br>- Create Express project<br>- Install Sequelize<br>- Create migration<br>- Create seeder with fake data<br>- Modify Config<br>- Modify model<br>- Create API<br>- Register to routes<br>- Run in Postman</p><h3>Create Express Project</h3><p>For create a project, you need install Nodejs and Express in your PC. Then, you can use this command</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dexpress%252520--no-view%252520user-api&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%25252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dexpress%25252520--no-view%25252520user-api&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c28f5152102706b6afa38df9e9d87e5a/href">https://medium.com/media/c28f5152102706b6afa38df9e9d87e5a/href</a></iframe><h3>Install Sequelize</h3><p>Sequelize is a library that make our Nodejs project can using database. It features solid transaction support, relations, eager and lazy loading, read replication and more. You can read more the documentation <a href="https://sequelize.org/master/">here</a>. For using Sequelize, you need to install sequelize and sequelize-cli (optional). But i recommend you to install sequelize-cli.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RPrvJeEq8r5cMgYZWGAWIg.png" /><figcaption>Sequelize CLI</figcaption></figure><h3>Create Migration</h3><p>To create migration file, you can use Sequelize CLI. Now we create a migration file for <strong>users table</strong> with name <strong>create_table_users</strong>. You can follow this command</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpx%252520sequelize%252520migration%25253Acreate%252520--name%25253Dcreate_table_users&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%25252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpx%25252520sequelize%25252520migration%2525253Acreate%25252520--name%2525253Dcreate_table_users&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0e31859f99439fe3b2dd4e4ce44dcf4/href">https://medium.com/media/e0e31859f99439fe3b2dd4e4ce44dcf4/href</a></iframe><p>Inside create_table_users file, we define the fields of users table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_1cM65QpvwuUNU6Z60rHA.png" /><figcaption>create table users migration</figcaption></figure><h3>Create Seeder with Fake Data</h3><p>Seeder is way to let us insert the initial data to our database, for generate dummy data its called Faker Factory. Next we create a seeder file with name <strong>user-seeders.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpx%252520sequelize%252520seed%25253Acreate%252520--name%25253Duser-seeders&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dapplication%25252Fx-sh%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpx%25252520sequelize%25252520seed%2525253Acreate%25252520--name%2525253Duser-seeders&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/47f335ac0ff6c6a60dbc298e749477fe/href">https://medium.com/media/47f335ac0ff6c6a60dbc298e749477fe/href</a></iframe><p>Inside the file, we will insert dummy data for users table using <a href="https://www.npmjs.com/package/faker">faker</a>. Because we have password field that need to be encrypted, so we also need <a href="https://www.npmjs.com/package/bcryptjs">bcryptjs</a> for encryption. Here is the user-seeders file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2HSzqi0-pSbUYLFR1jhow.png" /><figcaption>User Seeder File</figcaption></figure><h3>Modify Config</h3><p>To connect our Nodejs with database, we need some configuration in config file. How i config the configuration file are:<br>- Install <a href="https://www.npmjs.com/package/dotenv"><em>dotenv</em></a><br>- Create an .env file, fill the file with PORT, DB_HOST, DB_NAME, DB_USERNAME, DB_PASSWORD variables.<br>- import dotenv in app.js<br>- rename config.json to config.js<br>- convert json code into js code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g9YtRQ7ZANQbYK3LVfFLng.png" /><figcaption>config.js</figcaption></figure><p>Next, you can seed the data by <strong>npx sequelize db:seed:all</strong></p><h3>Modify Models</h3><p>As default, User Model created already when we install Sequelize into our Nodejs project, so we only need to adjust the field as we declare in migration file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aoc7bjPAhoXL5cs4c32MPQ.png" /><figcaption>User Model</figcaption></figure><h3>Create API</h3><p>For me, foldering is an important thing. With good folder management its help us to easy to maintain and scale up as well. Here is how i set the folders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*TwkOYuwrKtSdp8IJ_YYUEg.png" /><figcaption>Folder Management for API Nodejs</figcaption></figure><p>Inside <em>handler</em> folder we create folder as their focus. In example for user folder, its mean that folder will manage everything about user. Next we will write files inside user folder.</p><h4>Login.js</h4><p>This file is for create a login API only, we will check the email and password from request body with data in database. Will return success or failed depends the credential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlCMzs-p_z_RBD1ZSnLDzw.png" /><figcaption>login.js</figcaption></figure><h4>Index.js</h4><p>This file is like a parent file to import all files inside user folder, so when we call the file it will be easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*AJSSh3Qs2WXKRjEYhJdUbQ.png" /><figcaption>index.js</figcaption></figure><p>Now we will create a route file for users. The file is <strong>users.js</strong> inside routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*bDMbERXJaMXWtd8xh_SZyw.png" /><figcaption>users.js</figcaption></figure><h3>Register to Routes</h3><p>After we create file routes for users, now we need to register to app.js. Just add a line to add the users routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*nvm6kRdOO4hwHYHGBvp8Qw.png" /><figcaption>register users routes</figcaption></figure><h3>Run in Postman</h3><p>To make sure our API run as expected, we can try in Postman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQepNAPjaOEzwXHk-9s7WA.png" /><figcaption>Run in Postman</figcaption></figure><p>From the steps above we already create APIs with Express Nodejs. You can clone my project from my <a href="https://github.com/taufanfadhilah/microservice-user-api">Github</a> as well. Next, we continue to build Microservice Gateway with Express Nodejs. See you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7da5bf207630" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/build-simple-nodejs-api-for-microservice-7da5bf207630">Build Simple Nodejs API for Microservice</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Lumen API for Microservice]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/simple-lumen-api-for-microservice-de47e4b4d31c?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/de47e4b4d31c</guid>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 06:41:54 GMT</pubDate>
            <atom:updated>2020-12-03T09:30:57.626Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*K_M2brPyryNon2wy.png" /><figcaption>Lumen micro-framework by Laravel</figcaption></figure><p>Hi guys, in this article we will build a simple project with Lumen to integrate with microservice. If you don’t know what Microservice is, you can read <a href="https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15">my article</a> before.</p><p>Okay, let’s start with create a new project called <strong>property-api</strong>. After instalation finished, we next step is set up database stuff such as migrations, factory, seeders and models.</p><h3>Migration, Factory and Seeder</h3><p>Create a new migration file to create <strong>residences</strong> table.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%252Fx-php%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dpublic%252520function%252520up%2528%2529%25250A%252520%252520%252520%252520%25257B%25250A%252520%252520%252520%252520%252520%252520%252520%252520Schema%25253A%25253Acreate%2528%2527residences%2527%25252C%252520function%252520%2528Blueprint%252520%252524table%2529%252520%25257B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Eid%2528%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Estring%2528%2527name%2527%25252C%252520100%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Etext%2528%2527address%2527%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Estring%2528%2527phone%2527%25252C%252520100%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Etimestamps%2528%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%25257D%2529%25253B%25250A%252520%252520%252520%252520%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%25252Fx-php%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dpublic%25252520function%25252520up%252528%252529%2525250A%25252520%25252520%25252520%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Schema%2525253A%2525253Acreate%252528%252527residences%252527%2525252C%25252520function%25252520%252528Blueprint%25252520%25252524table%252529%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Eid%252528%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Estring%252528%252527name%252527%2525252C%25252520100%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Etext%252528%252527address%252527%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Estring%252528%252527phone%252527%2525252C%25252520100%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Etimestamps%252528%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%2525257D%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef52b95ca090f0f33d5cac25e01f03f1/href">https://medium.com/media/ef52b95ca090f0f33d5cac25e01f03f1/href</a></iframe><p>Second migration file to create <strong>houses</strong> table.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%252862%252C62%252C62%252C1%2529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%252Fx-php%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dpublic%252520function%252520up%2528%2529%25250A%252520%252520%252520%252520%25257B%25250A%252520%252520%252520%252520%252520%252520%252520%252520Schema%25253A%25253Acreate%2528%2527houses%2527%25252C%252520function%252520%2528Blueprint%252520%252524table%2529%252520%25257B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Eid%2528%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253EforeignId%2528%2527residence_id%2527%2529-%25253Econstrained%2528%2527residences%2527%2529-%25253EcascadeOnDelete%2528%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Einteger%2528%2527owner_id%2527%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Estring%2528%2527block%2527%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Estring%2528%2527number%2527%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252524table-%25253Etimestamps%2528%2529%25253B%25250A%252520%252520%252520%252520%252520%252520%252520%252520%25257D%2529%25253B%25250A%252520%252520%252520%252520%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%25252862%25252C62%25252C62%25252C1%252529%26t%3Dmonokai%26wt%3Dnone%26l%3Dtext%25252Fx-php%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dpublic%25252520function%25252520up%252528%252529%2525250A%25252520%25252520%25252520%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Schema%2525253A%2525253Acreate%252528%252527houses%252527%2525252C%25252520function%25252520%252528Blueprint%25252520%25252524table%252529%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Eid%252528%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253EforeignId%252528%252527residence_id%252527%252529-%2525253Econstrained%252528%252527residences%252527%252529-%2525253EcascadeOnDelete%252528%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Einteger%252528%252527owner_id%252527%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Estring%252528%252527block%252527%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Estring%252528%252527number%252527%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252524table-%2525253Etimestamps%252528%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%2525257D%252529%2525253B%2525250A%25252520%25252520%25252520%25252520%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f199b8a9d35b10855aa8420aad3ddaae/href">https://medium.com/media/f199b8a9d35b10855aa8420aad3ddaae/href</a></iframe><p>After you finish with your migration file, you can migrate with <strong>php artisan migrate</strong> command. Next continue to create factory file. Factory file purpose is to create fake data or dummy data, so we no need to input dummy data manually.</p><p>Create your first factory file named <strong>ResidenceFactory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFzNjMK3UD3EtQiuPaphuQ.png" /><figcaption>Residence Factory</figcaption></figure><p>Second factory file named <strong>HouseFactory</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vfaJ9ZkdbGfXJ4RVFyS9IQ.png" /><figcaption>House Factory</figcaption></figure><p>Finish with factory files, next is insert the fake data into our database by seeder. First seeder file named <strong>ResidencesTableSeeder</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*vuy7_cVTOd-c5H-Zc3_vxA.png" /><figcaption>Residence Seeder</figcaption></figure><p>Second seeder file named <strong>HouseTableSeeder</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*j5NOXwg7EEyxjym5rjtD-g.png" /><figcaption>House Seeder</figcaption></figure><p>Last, call Residence and House Seeder in <strong>DatabaseSeeder.php</strong> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C873Ypfv5ZEgtgkGNmpv-w.png" /><figcaption>Database Seeder</figcaption></figure><p>Before we seed the data into db, we need to set fillable field in our models. Residence Model should be like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*21BHpOlN9PkBZetFQz3_Zw.png" /><figcaption>Residence Model</figcaption></figure><p>For House Model can follow this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zHvPAcTaVajs3A-eL3k-Mg.png" /><figcaption>House Model</figcaption></figure><p>Finally, use <strong>php artisan db:seed</strong> to insert our dummy data.</p><h3>Controllers and Routes</h3><p>This section we will create APIs, with Eloquent it help us to create an API so much!. First, we create API to get all residences with houses relation in <strong>ResidenceController</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Ax2g3R3UsFV18Ls2i-NYA.png" /><figcaption>Residence Controller</figcaption></figure><p>In <strong>HouseController</strong>, we create an API to get all house with residence relation. Of course we set the filter to prepare FE need filtered data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErYaQp3HD3CMcOFAyH1tmg.png" /><figcaption>House Controller</figcaption></figure><p>Last, we register the API in <strong>routes</strong> file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59qpknZErvcuDOoS1pf0fg.png" /><figcaption>Routes File</figcaption></figure><p>Run the Lumen project with <strong>php -S localhost:8000 -t public</strong>.</p><h3>Testing with Postman</h3><p>Now we can check in Postman to make sure the data return as we expect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fRYFlotDTRruZdmxuMNVfQ.png" /><figcaption>Get All Residence API</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7VQOT4TYMiHERPPnTShjg.png" /><figcaption>Get All House API</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m527_w9k5_82wEz16tNXVA.png" /><figcaption>Get All House with Filter API</figcaption></figure><p>From instructions above we already create APIs with Lumen. You can clone my project from my <a href="https://github.com/taufanfadhilah/microservice-property-api"><strong>Github</strong></a> as well. Next, we continue to build <a href="https://taufanfadhilahiskandar.medium.com/build-simple-nodejs-api-for-microservice-7da5bf207630">User Service with Express Nodejs</a>. See you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de47e4b4d31c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Simple Microservice!]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/85c4a0af4c15</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 02:01:57 GMT</pubDate>
            <atom:updated>2020-12-13T09:48:42.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QeEdQfT1_DUQcFS3" /><figcaption>Photo by <a href="https://unsplash.com/@kaleidico?utm_source=medium&amp;utm_medium=referral">Kaleidico</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever feel your application is hard to maintain? or hard to scale up? if so i suggest you to know what microservice is.</p><p>Based on <a href="https://microservices.io/">microservice.io</a>, microservice is an architectural style that structures an application as a collection of services that are:<br>- Highly maintainable and testable<br>- Loosely coupled<br>- Independently deployable<br>- Organized around business capabilities<br>- Owned by a small team</p><p>I can say microservice is a way to split up our modules into services that can scale up based on their focus. In example <strong>User Modules</strong>, when we migrate into microservice we need to create a new database to store user data and also a dedicated project. So the benefit is we can focus for one service thats make easier to scale up and maintain.</p><p>As i mention above, benefit of microservice is we can focus for each service and make easier to scale up and maintain. Of course it has many benefits from server perspective, code perspective, security perspective etc. For the cons, what i feel is we need more resource such as more engineer and more server resource.</p><p>So, in this article i will share how i build a simple microservice using different tech stack (Lumen PHP and Express Nodejs). The case is about Property (User have house). We will set Nodejs as a Gateway and User Service, for Property Service we are using Lumen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*qnZUkxxJ7Q3VYBLqXPnO6Q.png" /><figcaption>The Architecture</figcaption></figure><p>Next, i will split into some articles that are:<br>1. <a href="https://taufanfadhilahiskandar.medium.com/build-your-simple-microservice-85c4a0af4c15">Introduction of Microservice</a><br>2. <a href="https://taufanfadhilahiskandar.medium.com/simple-lumen-api-for-microservice-de47e4b4d31c">Build API with Lumen for Microservice</a><br>3. <a href="https://taufanfadhilahiskandar.medium.com/build-simple-nodejs-api-for-microservice-7da5bf207630">Build API with Nodejs fro Microservice</a><br>4. <a href="https://taufanfadhilahiskandar.medium.com/build-api-gateway-with-nodejs-for-microservice-e78f667ba934">Build API Gateway with Nodejs for Microservice</a><br>5. <a href="https://taufanfadhilahiskandar.medium.com/using-jwt-as-authentication-in-api-gateway-638216d61cbd">Using JWT as Authentication in API Gateway</a></p><p>Thats all for the introduction, next we are going to build API with Lumen. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85c4a0af4c15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Promise on Svelte!]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/simple-promise-on-svelte-9700f3acbce?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9700f3acbce</guid>
            <category><![CDATA[svelte]]></category>
            <category><![CDATA[sveltejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 02:29:01 GMT</pubDate>
            <atom:updated>2020-12-01T02:23:06.326Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simple Promise in Svelte!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fnxmyuKCdkLuzXLL" /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=medium&amp;utm_medium=referral">Clément H</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>After take a look at <a href="https://svelte.dev/docs#await">Svelte documentation</a> i was found a brilliant way to using a promise. In this story i’m not talking about comparing performance, i just wanna talk about <em>developer experience</em>.</p><blockquote><strong>Developer Experience</strong> (DX) is the equivalent to User Experience (UX) when the user of the software or system is a developer.</blockquote><p>Let’s say everyone was understand about promises in Javascript. I really shock about implementation of promise in Svelte is very easy! Here is how i create a promise on React. I was create the code as simple as i can and it took more than 20 line of code <em>(i think you have other simplest code)</em>.</p><figure><img alt="Promise on React" src="https://cdn-images-1.medium.com/max/1024/1*cgaVkcqRVhMvuR_iQF_CzQ.png" /><figcaption>promise on React</figcaption></figure><p>Moving to Svelte, i was amazed that Javascript promise can be combined with HTML and its make code more readable. The line of code can be written less than 15 lines, amazing! We can put resolve and reject on HTML syntax and put with our components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EV4QPnZJ4iKzS3i9W1gNog.png" /><figcaption>promise on Svelte</figcaption></figure><p>This is one of many reason i support Svelte tobe a powerful Javascript framework because they are thinking out of the box. Really hope many developers can support Svelte to grow faster!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9700f3acbce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Three ways to using Laravel Socialite]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/three-ways-to-using-laravel-socialite-5f1280ed3c47?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f1280ed3c47</guid>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[socialite]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 06:22:30 GMT</pubDate>
            <atom:updated>2020-06-26T06:22:30.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RINGywmnTA2vh5_G" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi folks, in this story i just want to share my result after doing some experiments to using Laravel Socialite with several conditions. Basically we know authentication is a gate for our application to access some authorized feature inside. The manual authentication flow is we need email/username and password as credential, But time by time the flow was changes. Mostly we are using social media as part of our authentication module which we can get credential from them. <a href="https://laravel.com/docs/7.x/socialite#stateless-authentication">Laravel Socialite</a> come to be solution for this part and makes authentication with social media easier.</p><blockquote>In addition to typical, form based authentication, Laravel also provides a simple, convenient way to authenticate with OAuth providers using <a href="https://github.com/laravel/socialite">Laravel Socialite</a>. Socialite currently supports authentication with Facebook, Twitter, LinkedIn, Google, GitHub, GitLab and Bitbucket.</blockquote><p>About 3 years im using Socialite, i was found 3 kinds of authentication flow with social media. There are :<br>1. Authentication with social media on same website (monolith website)<br>2. Authentication with social media on website with REST API (client-server website)<br>3. Authentication with social media on mobile with REST API</p><h4><strong>Authentication with social media on same website (monolith website)</strong></h4><p>This is the basic flow on Socialite, we just redirect from our website to social media’s authentication page. After we authenticated on there, they will redirect back to our website, its called <em>callback</em>. To using this flow, you can implement this code.</p><figure><img alt="Socialite with monilithic website" src="https://cdn-images-1.medium.com/max/614/1*sV3lJRqAwIi9cjr2_Mof1g.png" /></figure><h4>Authentication with social media on website with REST API (client-server website)</h4><p>Similar with the flow before, the difference just we are as API provider that provide redirect to social media authentication page and received auth result. After that we check that credential on our system. To using this flow, you can implement this code.</p><figure><img alt="Socialite for REST website, just add ‘stateless()’" src="https://cdn-images-1.medium.com/max/689/1*4fEQKm-uI9A_cztv5Xd6uw.png" /></figure><h4>Authentication with social media on mobile with REST API</h4><p>This is the lastest flow that i knew and this is the simplest one!. Some mobile apps have they own library to authentication with social media (i.e <a href="https://www.npmjs.com/package/react-native-google-signin">React Native Google Signin</a>), but the problem is how to integrate social media auth with our system. And Socialite was provide for this problem. To using this flow, you can implement this code.</p><figure><img alt="Socialite for received token from mobile apps" src="https://cdn-images-1.medium.com/max/681/1*rB2KoxCJGh9SOwbLcYtr0w.png" /></figure><p>Why we do not using 2nd flow to tackle this problem? because the 2nd flow we redirect to social media auth as website url, not open the social media apps. So the problem is after we authenticated from social media, we can not back to apps again because our position is on website (i don’t know we can use <em>deeplink</em> or not, not trying yet). So this flow will make it easier.</p><p>So thats all i just want to share, hope it will help you to build your great product as easy as can!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f1280ed3c47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pengalaman Migrasi dari Next.js ke Nuxt.js]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/pengalaman-migrasi-dari-next-js-ke-nuxt-js-968a43854c36?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/968a43854c36</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Sat, 11 Jan 2020 10:43:13 GMT</pubDate>
            <atom:updated>2020-01-11T12:51:45.353Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Nuxt.js Logo" src="https://cdn-images-1.medium.com/max/1024/1*GzDBs0lKGg35RRK50dTNtQ.jpeg" /><figcaption>Nuxt js Logo</figcaption></figure><p>Hi teman-teman, kali ini aku mau nyoba sharing pandanganku tentang <a href="http://nuxtjs.org/"><strong>Nuxt.js</strong></a> yang cukup besar namanya dikalangan web developer khususnya <em>Front End Engineer</em>.</p><h3>Apa sih Nuxt.js itu?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*do3s5wnxBL20Jnpx" /><figcaption>Photo by <a href="https://unsplash.com/@emilep?utm_source=medium&amp;utm_medium=referral">Émile Perron</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Nuxt.js</strong> adalah sebuah framework untuk membangun <strong>Website Front End </strong>berbasis <strong>Vue js</strong>. Perbedaan antara <strong>Nuxt</strong> dengan <a href="https://vuejs.org/"><strong>Vue</strong></a> adalah cara dia rendering websitenya, kalau <strong>Nuxt</strong> di render dari server atau istilahnya <strong>SSR</strong> (<em>Server Side Rendering</em>) kalau <strong>Vue</strong> di render di browser user atau istilahnya <strong>CSR</strong> (<em>Client Side Rendering</em>).</p><p>Keunggulan <strong>Nuxt</strong> berdasarkan official websitenya adalah :</p><ul><li><strong>Modular</strong> : Nuxt dibangun berdasarkan <em>modular architecture</em> yang powerful, lebih dari <strong>50 modul</strong> telah disediakan oleh Nuxt untuk para developer agar tak kesusahan untuk menggunakannya.</li><li><strong>Performant</strong>: layaknya <strong>Vue</strong> yang terkenal lebih cepat dibandingkan kawan-kawannya, <strong>Nuxt</strong> pun disebutkan memiliki performansi yang lebih optimal dibandingkan framework <strong>SSR</strong> lainnya seperti <strong>Next.js</strong> dan <strong>Sapper</strong>.</li><li><strong>Enjoyable</strong>: fokus dari <strong>Nuxt</strong> ini ialah <strong><em>Developer Experience</em></strong>, dimana pengembang <strong>Nuxt</strong> ini memfokuskan untuk developer agar lebih nyaman dalam membangun aplikasinya.</li></ul><p>Beberapa web yang sudah menggunakan Nuxt.js untuk sisi front endnya antara lain <a href="http://gitlab.com/"><strong>Gitlab</strong></a>, <a href="http://lexar.id/"><strong>Lexar</strong></a>, dan <a href="http://crowde.co/"><strong>Crowde</strong></a>.</p><h3>Kenapa sih nyoba nyoba Nuxt?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JJ4cxnZ7_MEACUD7" /><figcaption>Photo by <a href="https://unsplash.com/@nicolasthomas?utm_source=medium&amp;utm_medium=referral">Nicolas Thomas</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Apasih yang bikin aku pingin nyoba Nuxt?</em> Sebelumnya aku kurang lebih sudah satu setengah tahun berkutat dengan <a href="https://nextjs.org/"><strong>Next</strong></a> (<strong>SSR</strong> nya <strong>React.js</strong>), sudah ngerasa nyaman sih dengan <strong>Next</strong> cuma karena lama-lama muncul rasa bosan akhirnya aku explore framework lainnya yaitu <strong>Nuxt</strong>. Buat experimenku (<a href="http://nuxt-recipe.taufanfadhilah.now.sh/"><strong>klik disini</strong></a>), aku bikin suatu apps tentang resep-resep makanan yang aku dapatkan API nya dari <a href="https://spoonacular.com/food-api/docs"><strong>spooncular.com</strong></a> dan API buat login (<em>pemanis doang sih</em>) dari <a href="https://jsonplaceholder.typicode.com/"><strong>jsonplaceholder</strong></a>. <em>Just visit my </em><a href="https://github.com/taufanfadhilah/Nuxt-RecipeWikia"><strong><em>Github here</em></strong></a><em>.</em></p><p>Hal yang ingin aku concern dari experiment ini bukan hanya sekedar consume API, tetapi ada hal lain yang belum dimiliki dari <strong>Next</strong> yaitu <strong><em>Middleware</em></strong>, <strong><em>Layout</em></strong>, <strong><em>Auth</em></strong> dan <strong><em>PWA</em></strong>. Selain itu pun ada yang bikin aku tertarik yaitu di modul <strong><em>Store</em></strong> dan <strong><em>Fetching</em></strong><em> </em><strong><em>Data</em></strong> yang cara penggunaannya berbeda dari framework lain.</p><h4>Yang Aku Rasakan dari Nuxt Adalah …</h4><p>Jadi dari experiment yang aku buat, aku pingin share pengalamanku dari modul <strong><em>Store</em></strong>, <strong><em>Middleware</em></strong>, <strong><em>vue-bootstrap</em></strong>, <strong><em>Axios</em></strong>, <strong><em>Routing</em></strong>, <strong><em>Layout</em></strong> dan <strong><em>nuxt.config</em></strong>.</p><ul><li><strong>Store</strong>: yang aku rasakan dari store di <strong>Nuxt</strong> ini adalah <strong>sangat simple dan ga bikin bingung kayak </strong><a href="https://redux.js.org/"><strong>Red*x</strong></a>, <em>hehehe</em>. Jadi di <strong>Nuxt</strong> ini sudah disediakan folder <strong>store</strong> buat naruh state managementnya. Di Nuxt pun kita tak dipaksa untuk bikin state management dalam satu file, tapi bisa kita buat sesuai kebutuhan dan nantinya akan digabungkan secara otomatis oleh <strong>Nuxt</strong> itu sendiri. Tiap file storenya itu memiliki initial <strong><em>state</em></strong>, <strong><em>mutation</em></strong>, <strong><em>getter</em></strong> dan <strong><em>actions</em></strong>.</li><li><strong>Middleware</strong>: kalau di framework lain, aku belum nemu framework yang menyediakan middleware dari sisi client, namun di <strong>Nuxt</strong> sudah disediakan. <strong>Middleware yang disini dapat diakses dari sisi server maupun client</strong>, sehingga kalau kita pingin buat modul authorization lebih mudah. Dan satu hal yang keren lainnya adalah middleware tak cuma untuk izin akses, namun bisa memberikan <strong>props</strong> untuk tujuan tertentu. <em>Gokil!</em></li><li><strong>Vue-bootstrap</strong>: di Nuxt CLI menyediakan berbagai macam framework css seperti <em>bootstrap</em>, <em>bulma</em>, <em>ant design</em> dan <em>vuetify</em>. Jadi kita ga perlu repot-repot install secara manual buat framework css dan yang terakirrr adalah <em>goodbye JQuery</em>, wqwq.</li><li><strong>Axios</strong> : axios disini sebenernya sama aja sih sama axios diluar sana. Cuma cara menggunakannya yang berbeda dari yang lain. Yang biasanya kita pake dengan cara <em>axios.get</em> kalau di Nuxt axios bawaannya cara pakenya adalah <strong><em>this.$axios.$get</em></strong> karena axios sudah diimplement dari dalem. Di nuxt config pun kita bisa setting banyak hal secara global seperti <strong><em>baseUrl</em></strong>, <strong><em>header</em></strong>, <strong><em>token</em></strong> dll.</li><li><strong>Routing</strong>: routing disini sebenernya sama seperti framework ssr lainnya, yaitu berdasarkan nama file dan folder di folder Page. Kalau misalkan kita ada parameter yang mau dilempar, <strong>nama file harus diawali dengan <em>underscore.</em></strong></li><li><strong>Layout</strong>: di Nuxt sudah disediakan folder Layout yang tujuannya kita bisa membuat kerangka layout seperti <strong><em>navbar</em></strong>, <strong><em>content</em></strong>, <strong><em>sidebar</em></strong>, <strong><em>footer</em></strong>. Nah untuk contentnya dia yang dinamis sesuai halaman. Benefit dari layout ini adalah kita <strong><em>ga perlu copas struktur halaman disetiap halamannya</em></strong> dan kita pun bisa memberikan pengondisian cukup dari file layout yang akan terimplementasi di setiap halaman yang menggunakan layout tersebut.</li></ul><h4>Penilaian!</h4><p>Jadi menurutku <strong>Nuxt</strong> ini dapet banget <strong><em>developer experience</em></strong> nya dan menurutku cocok untuk bikin project Front End dengan skala yang besar karena strukturnya lebih baku sehingga aman buat berbagai macam style developer. Kalau misalkan temen-temen backgroundnya fullstack dari <a href="http://laravel.com/"><strong>Laravel</strong></a>, kalian akan tau mengapa Laravel menggandeng Vue. Menurutku pun ada beberapa hal dari Laravel yang diimplementasikan di Nuxt seperti layout dan middleware. Kalau dari sisi minus nya adalah kalau temen-temen backgroundnya dari React yang bisa <strong><em>YOLO</em></strong> pas ngoding, disini bakalan ngerasa lebih strict. Yang awalnya ngerasa HTML, CSS, JS bisa dibuat dalam satu function tapi kalau di Vue ga boleh. Tapi percayalah, peraturan itu dibuat dengan tujuan yang baik bukan untuk dilanggar :3. <em>So, for me this one its so recommended to try!</em></p><blockquote>A coding standard makes sure that all the developers working on the project are following certain specified guidelines. The code can be easily understood and proper consistency is maintained.</blockquote><p>Thanks for visit and get in touch with me on <a href="https://www.linkedin.com/in/taufanfadhilahiskandar/">Linkedin</a> for futher sharing, see you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=968a43854c36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSuite membuat semua orang dapat berkolaborasi (Google Cloud Summit 2019, Jakarta)]]></title>
            <link>https://taufanfadhilahiskandar.medium.com/gsuite-membuat-semua-orang-dapat-berkolaborasi-google-cloud-summit-2019-jakarta-8782dd90386a?source=rss-39f1ec8edc9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8782dd90386a</guid>
            <category><![CDATA[remote-working]]></category>
            <category><![CDATA[workplace]]></category>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[work]]></category>
            <dc:creator><![CDATA[Taufan Fadhilah Iskandar]]></dc:creator>
            <pubDate>Thu, 14 Nov 2019 03:40:14 GMT</pubDate>
            <atom:updated>2019-11-14T06:48:38.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>GSuite semua orang dapat berkolaborasi (Google Cloud Summit 2019, Jakarta)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xx3KiNQKJKeCs2CC" /><figcaption>Photo by <a href="https://unsplash.com/@andrewtneel?utm_source=medium&amp;utm_medium=referral">Andrew Neel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong><em>Remote Working</em></strong> adalah sesuatu yang tak asing diucapkan dikalangan orang-orang IT, entah dia <em>programmer</em>, <em>devops</em>, maupun <em>designer</em>. <em>Remote Working</em> adalah suatu kegiatan dimana orang-orang bekerja diluar kantor, namun komunikasi tetap berlangsung secara baik. <em>Remote Working</em> dapat dilakukan dimana saja, di rumah, <em>coworking space</em>,<em> coffee shop</em>, maupun di kereta atau pesawat.</p><p>Mungkin kita akan bertanya, kenapa sih ada <strong><em>Remote Working</em></strong>? Apa enak nya?</p><p>Beberapa keuntungan melakukan remote working menurut <a href="https://remoteyear.com/blog/what-is-remote-work">Remote Year</a> adalah:</p><ul><li><strong><em>Flexible Lifestyle</em></strong>, Keuntungan ini akan sangat dirasakan bagi orang yang sudah memiliki anak, dimana <strong><em>Flexible Lifestyle</em></strong> membuat kita dapat mengatur jam kerja dan waktu untuk bersama keluarga dan juga tak perlu ke kantor yang mungkin dapat menghabiskan waktu lebih lama diperjalanan.</li><li><strong><em>Better Health and Wellness</em></strong>, Menurut <em>Royal Society for Public Health</em> di UK mengatakan bahwa tingkat stress pekerja remote lebih rendah dikarenakan kebebasannya dalam mengatur jam kerja, lokasi kerja, dan cara kerja.</li><li><strong><em>Renewed Passion for their Job</em></strong>, Bekerja diluar kantor dengan suasana dan lingkungan yang kaku dapat membuat rasa bosan datang. Dengan bekerja Remotely memungkinan untuk mendapatkan inspirasi baru yang meningkatkan kreatifitas.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u_vAnSzgzreYCR4r" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=medium&amp;utm_medium=referral">Annie Spratt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Remote Working cuma buat orang IT doang nih?</blockquote><p>Kalau programmer bisa bekerja remote menggunakan beberapa tools seperti <em>Git, Slack, </em>dan<em> Trello</em> dan designer bisa bekerja remote menggunakan tools seperti <em>Invision</em> dan <em>Figma</em>, bagaimana dengan yang non IT?</p><p>Pada conference <strong>Google Cloud Summit 2019</strong> di Jakarta, Google menawarkan produk yang sangat berguna untuk kolaborasi yaitu <strong>GSuite</strong>. Ada empat pilar yang google tawarkan pada produk ini yaitu:</p><ul><li><strong>Connect</strong>, Jangkau rekan kerja Anda dimana pun mereka berada. (<em>Mail, Calendar, Hangout</em>)</li><li><strong>Create</strong>, Semua yang dibutuhkan untuk mewujudkan project anda. (<em>Docs, Spreadsheet, Forms, Slides, Sites, App Maker, Keep</em>)</li><li><strong>Access</strong>, Simpan file dan langsung temukan yang Anda butuhkan. (<em>Drive, Cloude Search</em>)</li><li><strong>Control</strong>, Kelola pengguna, perangkat, dan data dengan aman dan mudah. (<em>Admin, Vault, Mobile, Workinsights</em>)</li></ul><p>Dengan fitur-fitur yang diberikan Google pada GSuite membuat pekerja dibidang non IT dapat melakukan remote working secara realtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*JkwjITEal0SnyrIKEB3qLg.jpeg" /><figcaption>Google Cloud Summit 2019 di Jakarta</figcaption></figure><h4>Kesimpulan</h4><p>Remote working adalah suatu metode kerja yang baru nge-trend beberapa tahun kebelakang. Remote working tak selalu berbuahkan hal-hal positif, namun remote working pun memiliki beberapa kekurangan dari sisi perusahaan maupun employee nya.</p><p>Mau berdiskusi tentang Remote Working? yuk connect saya di Linkedin (taufanfadhilahiskandar) dan Instagram (@taufanfadhilah)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8782dd90386a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>