<?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 Ludwig Leplan on Medium]]></title>
        <description><![CDATA[Stories by Ludwig Leplan on Medium]]></description>
        <link>https://medium.com/@ludwig-leplan?source=rss-4a7a293e40f0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*i4J1gamYT6ihk4QKUqMtvQ.jpeg</url>
            <title>Stories by Ludwig Leplan on Medium</title>
            <link>https://medium.com/@ludwig-leplan?source=rss-4a7a293e40f0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:44:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ludwig-leplan/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[How to create an API in 15 minutes with Nodejs and Loopback4]]></title>
            <link>https://ludwig-leplan.medium.com/how-to-create-an-api-in-15-minutes-with-nodejs-and-loopback4-130aaaee772d?source=rss-4a7a293e40f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/130aaaee772d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ludwig Leplan]]></dc:creator>
            <pubDate>Sun, 29 Nov 2020 13:21:51 GMT</pubDate>
            <atom:updated>2020-11-29T13:22:50.468Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_kfLVrhS76EssSvLRpy2kA.png" /></figure><h3>Here we go again</h3><p>Hi vatos ! today i’am gonna talk to you a little bit about loopback4, a not so popular framework created with <a href="https://nodejs.org/en/">NodeJs</a> (only 3k stars for the version 4) by <a href="https://www.ibm.com/fr-fr">IBM</a>, who allow you to create your API for prototype within a few minutes.</p><h3>Why ?</h3><p>As i said previously, <a href="https://loopback.io/doc/en/lb4/">loopback4</a> will allow you to create a nodejs API in a few minutes, but how can he do this ? dont we have to use an agnostic framework like expressjs in order to build a real personnalised architecture instead ? An architecture who suits perfectly to my company, my process, my wife and my dog ?</p><p>No. Really, you dont have to do that.</p><p>If you’re trying to prototype an app, you’re trying to convince people to believe in your project.</p><p>No matter the complexity of it, the goal here is to make thing simple and clear, before building a solid and robust architecture.</p><p>Loopback4 is pretty cool because it combines the both advantages about API generator and solid architecture building. it provide a standard nodejs API pattern with all that you’ll can find in a classic developed way API.</p><h3>Did you say generator ?</h3><blockquote>Exactly. Loopback4 is built in the way that you can think directly about the data that you want to treat. It’s built around Domain Driven Developement (Aka DDD) a pattern that focus on the business logic of your application.</blockquote><p>Theres <strong>loopback 4</strong> generator for :</p><ul><li>Models (Your data model)</li><li>Controllers (Your routes containing generated DB manipulation for CRUD operation)</li><li>Services</li><li>Datasources (the DB that you want to plug to your API)</li></ul><h3>Show me what you got !</h3><blockquote>Okay, now that your convinced, lets create our first API using loopback4. The first step about that is to generate your API. For this, you will need :</blockquote><ul><li><strong>NodeJs</strong> (you can find him here : <a href="https://nodejs.org/en/">https://nodejs.org/en/</a> )</li><li><strong>Loopback4</strong> ( npm i -g @loopback/cli )</li></ul><blockquote>Then, you can go to your terminal and generate your api by typing in your console : lb4 app</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiRuKzxSzyaaoO5IAByLFQ.png" /><figcaption>Loopback 4 application generator</figcaption></figure><blockquote><strong>Loopback4</strong> will ask you multiple informations about your project like the title, the description, and the default options that you will use for your project.</blockquote><p>Once everything is okay in terms of generation, you can access your api by :</p><ul><li>Accessing your folder</li><li>Typing npm start in your console</li></ul><p>Then, you can go to your <a href="http://localhost:3000/">http://localhost:3000/</a></p><h3>1. Generating our model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULbb5AkmHjwgyjlNpDviXg.png" /><figcaption>Loopback model generator</figcaption></figure><p>Lets be simple and efficiant, for this tutorial, we’re gonna treat cars, so we will generate a car model with multiple informations inside by typing lb4 model car in our console</p><p>Once you enter this command, loopback will ask you about the property that you want inside this model. When everything is okay, the file will be generated and available inside the model folder in your generated API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBLMcJk27esjyIIYio3Udg.png" /><figcaption>Loopback generated model</figcaption></figure><h3>2. Generating our datasource</h3><p>Datasource is the data connector to your DB system, loopback provide also a generator who allow you to generate the link to this datasource to persist your data in your API.</p><p>You can generate a datasource using the command : lb4 datasource car</p><p>for this example, we will use the in-memory DB. in-memory DB will continue to persist data while the API is running in our server. For production usage, i would recommend to use a classic database connector like MongoDB or SQL database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auY__G4GWjMgXOXWnGYCdg.png" /><figcaption>Loopback datasource generated</figcaption></figure><p>Once you enter this command, loopback will ask you about the property that you want inside this datasource. When everything is okay, the file will be generated and available inside the datasources folder in your generated API.</p><h3>Generating our repository</h3><p>We use the repository concept in LoopBack 4 to refer to an object with methods to perform local or remote operations. Such objects are resolved from <a href="https://loopback.io/doc/en/lb4/Binding.html">bindings</a> within a <a href="https://loopback.io/doc/en/lb4/Context.html">LoopBack 4 context</a>.</p><p>To generate a service, you can use the followed command : lb4 repository car</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9GDMlA3H_7vVnJDwdihGyw.png" /><figcaption>loopback respository generator</figcaption></figure><p>Once everthing is generated, a new repository file will be generated into our reposiroty folder. This file will contain all the mapping relation between our car model generated previsously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ngwXpelM3zrim2kax_QtMQ.png" /><figcaption>loopback generated repository</figcaption></figure><h3>Generating our controllers</h3><p>Last thing, in order to make all this previously generated component work with each other, you’ll need to create a controller. The controller is the orchestrator of your API call actions.</p><p>It will allow you to do operation related to the linked model / repository that you’ve generated before.</p><p>Loopback 4 generated controller allow you to have a fully CRUD REST file with all the classic operations that you’ll do on an application or a website such as GET, POST, PUT, PATCH, DELETE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzIqkyk_81SuKKXm0bWsTg.png" /><figcaption>loopback controller generator</figcaption></figure><p>Once its generated, you’ll see a new file created in the controller folder of your Loopback 4 API with all the actions listed before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YgvJojw1uoBqRnCYYQCt5A.png" /><figcaption>Controller genereted from both car model / car repository</figcaption></figure><h3>Launch it !</h3><p>You can now start your new fresh API by running a yarn / npm start and see whats happen.</p><p>If you go to your <a href="http://localhost:3000/">http://localhost:3000</a> you’ll see the default API page with two links (to openapi.json and generated documentation about your API)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OoIhvCgX7tDS9vRYcP9UTg.png" /><figcaption>Loopback api default page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ACyfX2ThhzJMtjf6sWkkJA.png" /><figcaption>Loopback genereted documentation</figcaption></figure><h3>Test it !</h3><p>If you want to test a request to the API, you should use http client in order to see whats really happen during the call. We are gonna use P<a href="https://www.postman.com/">ostman</a> for this (but other client will suits well too)</p><p><strong>/POST</strong> a new car :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtDgmZEsUZHCS_ks_aT_4g.png" /><figcaption>Loopback API get call using postman</figcaption></figure><p><strong>/GET</strong> cars list :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8JDATVw2iDalgcHqihKqA.png" /><figcaption>Loopback API post call using postman</figcaption></figure><p>As you can see, everything seems to be runing. If we want to go further, we can also add a generated ID propertys instead of specifying it at each /post request.</p><h3><strong>Conclusion &amp; usefull links</strong></h3><p>As you saw, Loopback 4 is a very nice framework with an incredibely complete generator in order to go straight to the point. In the next article, i’ll talk about my personal experience using it and how you can implement an authentication system on your API.</p><p>If you got questions, i got answers, feel free to contact me.</p><p>And if you want to implement it in your company, feel free also to contact us at this website : <a href="https://grow-your-business.fr/">https://grow-your-business.fr/</a> (this is our agency)</p><p>You can also find the github source of this article here :</p><p><a href="https://github.com/lulul62/medium-loopback4-article">https://github.com/lulul62/medium-loopback4-article</a></p><p>Have a nice day ! :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=130aaaee772d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to presentational / container architecture in Vuejs]]></title>
            <link>https://ludwig-leplan.medium.com/introduction-to-presentational-container-architecture-in-vuejs-698114d22c58?source=rss-4a7a293e40f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/698114d22c58</guid>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Ludwig Leplan]]></dc:creator>
            <pubDate>Fri, 16 Aug 2019 11:15:00 GMT</pubDate>
            <atom:updated>2019-08-16T11:15:00.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4gA6AP8gT3IDQsg--LLBw.png" /></figure><blockquote>Whats’up hombre, today, and for my first post, we are gonna see the implementation of the presentational &amp; container architecture in Vuejs. The goal of that post is to look at how we can implement this pattern in our codebase and see the benefits of it in our coder life.</blockquote><blockquote>I know that there are already some blog post about what it is but nothing about how to apply that in Vuejs application.</blockquote><h3>The what ?</h3><p>Container and presentational components is a simple unopiniated pattern about “how can i get my code cleaner and seperate my components ?” in two categories :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*wNAlPcDKKGLpkLAVfmU7qg.png" /><figcaption>Here is a quick uml about what we are talking about..</figcaption></figure><ul><li><strong>Containers</strong> that compose the skeleton of our app identified as layout components like a sub-menu and the components that composes our feature in the application like an users page components who will check for a token in database and show the right slots component presentation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_fJ-CwE4qklev0DykdVZWg.png" /><figcaption>&lt;jumbotron-container /&gt; who is our container component.</figcaption></figure><ul><li><strong>Presentation</strong> components that englobe our data from containers and show it into the application. thoses components are not allowed to fetch their own data but receive his data from his parent, in this context, we are passing vuex value as props in our container who can be ‘Success’ or ‘Error’ to our child presentation component.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xynz25rjEkaBfROSp_gVhw.png" /><figcaption>&lt;page-jumbotron /&gt; who is our presentational component.</figcaption></figure><h3>The why ?</h3><p>This pattern is designed to help ya at code organization and leave the “Spaghetti” code management. with this architecture, you well be able to clearly seperate the functionnal components that will retrieves your data and make action from the components who will receive the data.</p><p>The other major benefits inside that pattern is that it make all of your presentation components reusable in multiple context because there are not attached to a specific datasource.</p><h3>The when ?</h3><p>You can implement this pattern whenever you want in the application, at the start of his developement or later if you want since the refactoring associated to this pattern dont cost a lot of time since its just about move functions in the right container components and pass the data with the appropriated state management in your presentation components (it can be <a href="https://fr.vuejs.org/v2/guide/components-props.html">props</a>, <a href="https://vuex.vuejs.org/">vuex</a> or <a href="https://medium.com/@andrejsabrickis/https-medium-com-andrejsabrickis-create-simple-eventbus-to-communicate-between-vue-js-components-cdc11cd59860">$bus</a>)</p><h3>The who ?</h3><p>Anybody who is familiar with javascript modern developement is able to implement this pattern into an app, even Vuejs newbies. It dont require a lot of knowledge about the framework but only good senses about where do i put my actions and data call, whatever state management you’ll be using..</p><h3><strong>Conclusion</strong></h3><blockquote>Container / presentational architecture is a good way to start with code quality since it force the user to make reusable components and it dont nee expert coding skills to make things act right. You can push this pattern forward by using advanced state management pattern like <a href="https://github.com/mobxjs/mobx-vue">Mobx</a> who is oriented for this type of architecture.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=698114d22c58" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>