<?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 Richard Luo on Medium]]></title>
        <description><![CDATA[Stories by Richard Luo on Medium]]></description>
        <link>https://medium.com/@richardluo_2507?source=rss-e3acbfe82cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*N3kjUbv6zbOsCZeyxbEP_w.jpeg</url>
            <title>Stories by Richard Luo on Medium</title>
            <link>https://medium.com/@richardluo_2507?source=rss-e3acbfe82cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:44:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@richardluo_2507/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 be a good PR reviewer]]></title>
            <link>https://medium.com/@richardluo_2507/how-to-be-a-good-pr-reviewer-4411ae5cc42?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4411ae5cc42</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[pr]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Tue, 11 Jul 2023 21:40:53 GMT</pubDate>
            <atom:updated>2024-01-01T21:30:14.517Z</atom:updated>
            <content:encoded><![CDATA[<p>As a developer, one of your responsibility is to review pull requests(PR) to maintain code quality, ensure best practices, and foster a positive team dynamic. In this article, we will explore some items that can make code reviewing more pleasant and productive for both the author and the reviewer.</p><ol><li><strong>Understanding the Context</strong>:<br>Start by thoroughly understanding the purpose of the pull request and each change it has. Confusion and conflict from PR comments are often from a lack of context for code changes. And make sure to ask if the current context provided is not sufficient to understand the code changes.</li><li><strong>Acknowledge the Positive</strong>:<br>PR review can be an excellent place to spread positivity. Make sure to acknowledge the positive code changes as well as giving constructive feedback! This can be from something like well-structured code, thoughtful documentation, or the acknowledgement of the importance of the PR and the work well done once it will be merged.</li><li><strong>Set your tone right</strong>:<br>PR reviewing is a collaborative process more than competitive, make sure to use a positive and respectful tone to encourage collaboration. This is especially important as most feedback will be written than spoken so often the author or other reviewer might miss out on the tone of the feedback.</li><li><strong>Review the Code and Logic</strong>:<br>Carefully examine the code changes for potential bugs, logic errors, and edge cases that may have been overlooked.<br>Make sure to test the changes locally!<br>Make sure the code does not break from the standard convention your team has set!</li><li><strong>Give clear and constructive feedback:</strong><br>Offer feedback that is actionable and point out areas that can be improved and suggest possible solutions or alternatives. Make sure to give context to your suggested changes if it is not clear. <br>Give an indicator of what is a blocker(from merging the PR) and what is not.</li><li><strong>Give the Final Approval.</strong><br>Once the author has addressed your feedback satisfactorily, give your final approval for the pull request, make sure the reviewee knows you’ve thoroughly read and tested the PR and it is ready to be merged.</li></ol><p><strong>Final Say:</strong></p><p>It is important to remember sometimes code reviews can be more interpersonal than technical. Remember, being a good reviewer goes beyond identifying errors; it’s about helping your fellow developers grow and excel in their coding journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4411ae5cc42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Tips and Strategies for Django Developers]]></title>
            <link>https://levelup.gitconnected.com/practical-tips-and-strategies-for-django-developers-db4d68a2d8d2?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/db4d68a2d8d2</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[decorators]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Thu, 06 Apr 2023 02:35:51 GMT</pubDate>
            <atom:updated>2023-04-15T04:33:33.970Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.djangoproject.com/">Django</a> is a popular and versatile web framework that has become a top choice for building web applications. In this guide, we’ll explore some of the effective tips and strategies for Django development, covering a wide range of topics from database models, debugging, performance optimization, decorators, and application code.</p><p>Whether you’re just getting started with Django or looking to optimize your workflow, this guide will provide you with valuable insights and practical advice to help you become a more efficient and productive Django developer. Of course, everyone’s experience with Django development is different, so feel free to disagree with any of my opinions or suggestions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OleQ4OsGWfHCAf7k8mdIKg.jpeg" /></figure><p>1. Avoid N+1 Queries, more information on this topic: <a href="https://medium.com/gitconnected/n-1-queries-in-django-how-they-affect-performance-and-how-to-fix-and-find-them-8123f1500aae">https://medium.com/gitconnected/n-1-queries-in-django-how-they-affect-performance-and-how-to-fix-and-find-them-8123f1500aae</a></p><p>2. Unless you absolutely have to, try not to over-optimize Django database queries with only , defer, that select only specific columns to return, most of the time in my experience it brings complication to the code without much performance gain.</p><p>3. If you have a variable that you use for almost every API/function, consider using a global pattern so you don’t have to pass the variable as a parameter everywhere.</p><p>For example, let’s say we hit an API and that API goes through 2 helper functions which both need therequest.userobject:</p><pre>option 1, pass in user ✅<br><br># Entry point for the API<br>def my_view_a(request):<br>    helper_a(request.user)<br><br>def helper_a(user):<br>    if user:<br>      ...<br>    helper_b(user)<br><br>def helper_b(user):<br>    if user:<br>      ...<br><br><br>option 2, use get_current_user ✅<br>import threading<br># Create a thread-local variable<br>_thread_locals = threading.local()<br><br>def get_current_user():<br>    return getattr(_thread_locals, &#39;user&#39;, None)<br><br># Run this as a middleware<br>def set_current_user(request):<br>    _thread_locals.user = request.user<br># ----------------------------------------<br><br># Entry point for the API<br># set_current_user(request) is ran everytime you hit any API<br>def my_view_a(request):<br>    helper_a()<br><br>def helper_a():<br>    user = get_current_user()<br>    if user:<br>      ...<br>    helper_b()<br><br>def helper_b():<br>    user = get_current_user()<br>    if user:<br>      ...</pre><p>4. Consider using bulk_create and bulk_update to run multiple changes to your models, this will make sure all the updates are running in 1 query</p><p>For example, let’s say we are creating some object with name and value column:</p><pre># Create three objects to be inserted into your database<br>my_objects = [<br>    MyModel(name=&#39;foo&#39;, value=1),<br>    MyModel(name=&#39;bar&#39;, value=2),<br>    MyModel(name=&#39;baz&#39;, value=3),<br>]<br><br>yes ✅<br># Use bulk_create() to create the objects in the database<br># This runs 1 query<br>MyModel.objects.bulk_create(my_objects)<br><br>No ❌<br># Create a new MyModel object and save it to the database<br># This will run 3 queries<br>For object in my_objects:<br>  object.save()</pre><p>One thing to beware of is that bulk_create and bulk_update will not run the model’s save() method or pre_save / post_save signals. So a field like create_at = models.DataTimeField(auto_now_add=True) in your model will not automatically update. <a href="https://docs.djangoproject.com/en/4.1/ref/models/querysets/#bulk-create">https://docs.djangoproject.com/en/4.1/ref/models/querysets/#bulk-create</a></p><p>5. Consider using <a href="https://www.django-rest-framework.org/">Django rest framework</a>(DRF) to build your APIs, it has a lot of built-in functionality like serialization, authentication, and pagination to make development easier and more standardized.</p><p>6. Django provides some great decorators, use them!<br>For example,</p><pre># Requires user to be logged in before they can access the API<br><br>yes ✅<br>@login_required<br>def my_view(request):<br>    pass<br><br>No ❌<br>def my_view(request):<br>    if request.user and request.user.is_authenticated:<br>        pass</pre><p>or</p><pre># Requires a speicfic http method to access the API<br><br>yes ✅<br>@required_http_method([&quot;GET&quot;, &quot;POST&quot;])<br>def my_view(request):<br>    pass<br><br>No ❌<br>def my_view(request):<br>    if request.method == &#39;GET&#39; or request.method == &#39;POST&#39;:<br>        pass<br></pre><p>7. @cache_property is a decorator that allows you to cache the result of a property in Django. Add this to reuse a value without doing the calculation again. You can also invalidate the cache by deleting the value.</p><p>For example, let’s say we are trying to access my_property from MyClass :</p><pre>from django.utils.functional import cached_property<br><br>class MyClass:<br>    @cached_property<br>    def my_property(self):<br>        # Do some expensive computation here<br>        return result<br><br>obj = MyClass()<br># Access the cached property, which will perform the expensive computation and cache the result<br>value = obj.my_property<br><br># Remove the cached value<br>del obj.my_property</pre><p>8. When running ./manage.py shell, make debugging easier by using Bpython, Bpython is an enhanced Python interactive interpreter that provides a more user-friendly and feature-rich interface for executing Python code in an interactive session. Bpython can be installed via Pip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clJCzvDhu0L5-1eSG3gn0g.png" /><figcaption>It makes auto-suggests as you type</figcaption></figure><p>9. Beware of migrations that can cause downtime in Django, if they are applied during peak hours, your user might experience interruption and downtime while using your app. This largely depends on your database but something simple like adding a default value to a new column or adding an index to an existing table might cause downtime. Example article: <a href="https://pankrat.github.io/2015/django-migrations-without-downtimes/">https://pankrat.github.io/2015/django-migrations-without-downtimes/</a></p><p>10. Have backward-compatible migrations, in case you ever want to roll back your releases, you want to make sure your database will work no matter which version of code your new and old servers are on, this also applies if you are doing A/B test. Example article: <a href="https://medium.com/3yourmind/keeping-django-database-migrations-backward-compatible-727820260dbb">https://medium.com/3yourmind/keeping-django-database-migrations-backward-compatible-727820260dbb</a></p><p>11. Beware of the difference between your local environment and your production environment. For example, if you run two computationally expensive API calls(let’s say each call takes 5 seconds to finish). If you run them both locally at the same time, you might see one API call that took 5 seconds and the other took 10 seconds, this is due to your local environment might be single-processed and the first call will block the second call(this is the default behavior when you run locally with python manage.py runserver), this behavior might not exist in production as you will have multiple servers taking requests simultaneously.</p><p>And that is it, I hope you enjoyed this article and let me know if any of the tips are helpful to you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4d68a2d8d2" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/practical-tips-and-strategies-for-django-developers-db4d68a2d8d2">Practical Tips and Strategies for Django Developers</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[N+1 Queries in Django: How They Affect Performance and How to Fix and Find Them]]></title>
            <link>https://levelup.gitconnected.com/n-1-queries-in-django-how-they-affect-performance-and-how-to-fix-and-find-them-8123f1500aae?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8123f1500aae</guid>
            <category><![CDATA[n-plus-1-queries]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Mon, 27 Mar 2023 00:44:03 GMT</pubDate>
            <atom:updated>2023-03-28T03:14:48.296Z</atom:updated>
            <content:encoded><![CDATA[<p>Table of content:</p><ol><li><a href="#7801">Intro</a></li><li><a href="#b122">What is ORM</a></li><li><a href="#488c">Now To N+1 Query</a></li><li><a href="#f2d3">Now let’s fix it</a></li><li><a href="#9a80">How to find them</a></li><li><a href="#1eb5">Bonus</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9qdhKYqRUrw7d35i.png" /></figure><h3>1. Intro:</h3><p><a href="https://www.djangoproject.com/">Django</a> is a powerful and popular web framework that allows developers to quickly build web applications and APIs. However, as with any framework, it is not without its share of problems. One of the most common issues developers face when working with Django applications is N+1 queries. These queries can lead to slow loading times, poor responsiveness, and increased server load on your application. Therefore, it is crucial for you to understand how to identify and solve N+1 query issues in your application.</p><h3>2. What is ORM:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAvQ7-YmkWsoMWP1SCkpBw.jpeg" /></figure><p>Before we get into the problem, we need to first understand ORM(Object-Relational Mapping), which is the technique used in Django(and many other web frameworks) to interact with databases in a more Pythonic way. So instead of defining your database manually yourself, you can instead do something like this below to create an organization Table with name and description columns in the database of your choosing:</p><pre>from django.db import models<br><br>class Organization(models.Model):<br>    name = models.CharField(max_length=255)<br>    description = models.TextField(blank=True)<br><br># Under the hood, if we were using PostgresDB, <br># the query it ran will look something like this:<br><br># CREATE TABLE organization (<br>#  id SERIAL PRIMARY KEY,<br>#  name VARCHAR(255),<br>#  description TEXT<br># );</pre><p>You can then interact with the table with python code like this:</p><pre>current_organization = Organization.objects.filter(id=1)<br>print(current_organization.name)<br><br># Under the hood, if you do str(current_organization.query), <br># you will see the query it will run for you and <br># it might look like this:<br><br># select name, description from organization where id = 1;</pre><p>As you can see, Django ORM allows developers to work with databases using Python code, which makes it easier to build and maintain complex web applications. However, this is also where we might encounter the N+1 query issue.</p><h3>3. Now To N+1 Query:</h3><p>The N+1 query problem can occur when a developer makes a query using Django ORM to retrieve data from a database, if that data has a foreign key for example, then we might make additional queries to retrieve related data for each result of the original query. This results in a large number of database queries, which can cause performance issues and slow down the application.</p><p>For example, consider a Django application that has a user and a user information model, User database model contains the name, email of the user and the UserInformation database model contains the location information of the user:</p><pre>from django.db import models<br><br>class User(models.Model):<br>    email = models.EmailField(unique=True)<br>    first_name = models.CharField(max_length=30, blank=True)<br>    last_name = models.CharField(max_length=30, blank=True)<br><br>class UserInformation(models.Model):<br>    address = models.CharField(max_length=255)<br>    city = models.CharField(max_length=255)<br>    state = models.CharField(max_length=255)<br>    zipcode = models.CharField(max_length=10)<br>    user = models.OneToOneField(<br>      User, on_delete=models.CASCADE, related_name=&#39;user_information&#39;)<br></pre><p>Let’s say we want to print all the user and their location information, we might do something like:</p><pre>users = User.objects.all()<br># runs 1 query<br><br>for user in users:<br>    print(f&#39;user is {user}, address is {user.user_information.address}&#39;)<br>    # let&#39;s say there are total of 1000 users, we will then run<br>    # 1000 extra queries for each iteration!</pre><p>This code will make N+1 queries to the database, The 1 query to retrieve all the users, and N queries to retrieve user&#39;s information, where N is the number of users retrieved from the first query(hence the N+1). As you can see, this can be a significant performance problem since you can be overloading the database with the number of extra queries.</p><h3>4. Now let’s fix it:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZeusH49wa82B9eL9tSdkNg.jpeg" /></figure><p>Fortunately, Django provides a solution to the n+1 query problem which is to use <a href="https://docs.djangoproject.com/en/4.1/ref/models/querysets/#select-related">select_related</a>() and <a href="https://docs.djangoproject.com/en/4.1/ref/models/querysets/#prefetch-related">prefetch_related</a>() to retrieve related data in the original query.</p><p>select_related() is used to retrieve related objects that are referenced in a foreign key or one-to-one relationship. prefetch_related() is used to retrieve related objects that are referenced in a many-to-many or many-to-one relationship.</p><p>Here’s an example of how to use select_related() to fix the above issue:</p><pre>users = User.objects.select_related(&#39;user_information&#39;).all()<br># runs 1 query and gets all the related user_information<br># Under the hood, this query does a join with the user information foreign key<br><br>for user in users:<br>    print(f&#39;user is {user}, address is {user.user_information.address}&#39;)<br>    # now this doesn&#39;t run any database query!</pre><p>This query will retrieve all the users and their associated information in a single query. The related information objects will be cached, so if the developer later accesses them, there will be no additional queries to the database.</p><p>So in conclusion, by using select_related() and prefetch_related(), developers can avoid the N+1 query problem!</p><h3>5. How to find them:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k9KFTdESK-QHeBIbchoN-Q.jpeg" /></figure><p>The N+1 query issue we saw above is simple to catch, however in real-life/production scenarios, it might not be as simple. In my experience, I find selected_related() or prefetch_related() for foreign keys might be missed if the logic between querying the object and using the object spans a few functions deep(ie. you might query the database object in the current function/middleware/decorator but only use it in a child functions later on).</p><p>So even if you missed it during development, it is fine if you have it good way to detect it later on. In my experience, here are the ways I use to find these issues in production and development environment.</p><p><strong>Production</strong>: Use Datadog’s APM tracing feature: Datadog provides an APM(Application Performance Monitoring) tool that can trace the execution of Django queries and provide insights into the performance of your application. By tracing the execution of your Django queries with Datadog, you can identify N+1 query issues and optimize your queries to improve performance. Datadog provides good <a href="https://www.datadoghq.com/product/apm/">documentation</a> to get it setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNJekKcUmVYlbkox3PJrtw.png" /><figcaption>This is an example APM trace you might see in Datadog, if you see a similar pattern of the same query, then this might be an N+1 issue</figcaption></figure><p><strong>Development</strong>: Use Django’s built-in logging framework: Django provides a built-in logging framework that can be used to log SQL queries and other debug information to a file or to the console. By logging your SQL queries in Django, you can analyze them and identify N+1 query issues. To enable SQL query logging in Django, you can add the following configuration to your Django settings:</p><pre>LOGGING = {<br>    &#39;version&#39;: 1,<br>    &#39;handlers&#39;: {<br>        &#39;console&#39;: {<br>            &#39;class&#39;: &#39;logging.StreamHandler&#39;,<br>        },<br>        &#39;file&#39;: {<br>            &#39;class&#39;: &#39;logging.FileHandler&#39;,<br>            &#39;filename&#39;: &#39;/path/to/your/logfile&#39;,<br>        },<br>    },<br>    &#39;loggers&#39;: {<br>        &#39;django.db&#39;: {<br>            &#39;handlers&#39;: [&#39;console&#39;, &#39;file&#39;],<br>            &#39;level&#39;: &#39;DEBUG&#39;,<br>        },<br>    },<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*5EmqYEUlfbueoJpDoDwtlA.png" /><figcaption>If you see the same query ran multiple times in the same time frame, then this could be a N+1 Issue</figcaption></figure><h3>Bonus:</h3><p>In addition to manually finding N+1s, you can also automate this process. There are a few libraries that do the job by blocking lazy queries or extra queries from running altogether and may raise an exception if a N+1 does happen.</p><p>Here are a few of them ranked by stars:</p><p><a href="https://github.com/dabapps/django-zen-queries">https://github.com/dabapps/django-zen-queries</a></p><p><a href="https://github.com/charettes/django-seal">GitHub - charettes/django-seal: Django application providing queryset sealing capability.</a></p><p><a href="https://github.com/kezabelle/django-shouty-orm">https://github.com/kezabelle/django-shouty-orm</a></p><p>Here is another <a href="https://suor.github.io/blog/2023/03/26/ban-1-plus-n-in-django/">blog</a> on this topic I read through and is useful, but it is worth doing your own research(and perhaps diving into the libraries) before using these methods in production, they might not 100% work for your setup and scenarios.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8123f1500aae" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/n-1-queries-in-django-how-they-affect-performance-and-how-to-fix-and-find-them-8123f1500aae">N+1 Queries in Django: How They Affect Performance and How to Fix and Find Them</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start your local dev environment the fast way, with examples️]]></title>
            <link>https://levelup.gitconnected.com/start-your-local-dev-environment-the-fast-way-with-examples-%EF%B8%8F-39e9565fb3d5?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/39e9565fb3d5</guid>
            <category><![CDATA[honcho]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[dev-environment-setup]]></category>
            <category><![CDATA[osascript]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Sun, 19 Mar 2023 20:17:17 GMT</pubDate>
            <atom:updated>2023-03-23T22:55:52.667Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>TL;DR</strong>: Use bash alias, docker-compose, honcho, or osascript to automate starting your local environment</p><p>As a Django, React full-stack engineer in my early years, I find one routine I constantly have to do in the morning is starting up my multiple local services(database, backend, frontend, workers, etc). In the beginning, the steps I have to do might be similar to this:</p><ol><li>Open terminal</li><li>cd to my backend Django folder</li><li>Run something among lines of python manage runserver 0.0.0.0:8000 to start my main server</li><li>Open up a second panel and cdto my celery worker folder</li><li>run python manage run worker to start my celery workers</li><li>Open up a third panel and cdto my frontend folder</li><li>Run something among lines of yarn watch:frontendto start up your react app</li><li>etc</li></ol><p>Eventually, I smartened up and learned to find ways to reduce steps 1- 8 to only 1 or 2 steps instead. In this article, I am going to go through 4 ways to make starting your local environment much faster, note the OS I am using for these setups are <strong>Ubuntu </strong>and <strong>Mac</strong>. Feel free to leave a comment if there are other ways you use as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQGajsfUv47xqfwOYCDsFA.gif" /><figcaption>Easy setup!</figcaption></figure><p>1. The simplest way to start your environment is via Alias in zshrc or bashrc , zshrc or bashrc is a configuration file that runs whenever you open up the terminal(for Mac and Linux). You can then set up Aliases that can be run(or triggered automatically) instead of running the full command, multiple commands can be combined together with &amp;&amp;or || .</p><pre># Example Alias:<br><br>alias server=&#39;cd ~/project/test_automate/ &amp;&amp; python manage.py runserver localhost:8000&#39;<br>alias app=&#39;cd ~/project/test_automate/ &amp;&amp; yarn watch:frontend&#39;<br><br># I can open 2 panels in my terminal, for the first one run &quot;server&quot; <br># and for the second one run &quot;app&quot;.</pre><p>2. <a href="https://pypi.org/project/honcho/">Honcho</a>, honcho is a tool for managing Procfile-based applications as the project page says. By running honcho -f procfile start, it can call all the commands you’ve listed in the procfile file in one go. The pros of Honcho are that it is very easy to setup(by pip install honcho), and you can configure different files based on your environment(Procfile.production, Procfile.testing, Procfile.development, etc), the con is that all the applications it runs are in one terminal/window, so the logs/message it produces can be very hard to read since everything is printed together.</p><p>Below are the example of the Procfile files and the terminal log once you run honcho.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmlklbeO1t3oXhaaquPFUQ.png" /><figcaption>Everything is running under one terminal and differentiated by colors on the left</figcaption></figure><pre># Procfile.development<br># Starts the web server, worker and the frontend<br><br>web: python manage.py runserver<br>worker: python manage.py runworker<br>frontend: yarn watch:frontend</pre><pre># Procfile.production<br><br>web: ddtrace-run gunicorn captivateiq.wsgi --log-file -<br>worker: ...<br>...</pre><p>3. <a href="https://docs.docker.com/compose/">Docker-compose</a>: Docker is a really good way to start your local environment using YAML, let’s say you have a bunch of services you have to start and some depend on others(you have to start up the database and then run your backend server and then run the frontend). You can instead configure all the services in your YAML, and run docker-compose up to start everything in one go. I have an example YAML I use but for the full explanation or other usages of docker-compose, it is probably better to read their official documentation.</p><p>The pros of using docker-compose are that Docker/Docker-compose is available on any OS and the YAML files are very portable and reusable. The container themselves are also isolated so you can delete a container and spin one up without affecting your system. But there are also a few cons, for one, Docker and setting up the YAML file imo has a steep learning curve, also personally I found the performance when you do containerize your services are usually slower than running it uncontainerized, especially some web application frameworks (ie. php laravel, python django to some extend) are extremely slow when trying to access containerized databases.</p><pre># Example Yaml, &quot;docker-compose up&quot; on this yaml will start up a node server, <br># a redis and a posgres database that the node server will connect to.<br># The postgres will be populated with seed data and both the postgres and the <br># node server is connected to your system volume<br><br>version: &quot;2&quot;<br>services:<br>  server:<br>    container_name: growth_graphql<br>    build:<br>      context: .<br>      dockerfile: Dockerfile<br>    command: [&quot;./init.sh&quot;]<br>    # command: &quot;tail -f /dev/null&quot;<br>    environment:<br>      - NODE_ENV=dev # Possible values are stg, prod, dev<br>    volumes:<br>      - ./src:/opt/app/src<br>    ports:<br>      - 4000:4000<br>  self-redis:<br>    container_name: self-redis<br>    image: redis<br><br>  self-postgres:<br>    container_name: self-postgres<br>    image: postgres<br>    restart: always<br>    environment:<br>      POSTGRES_USER: better<br>      POSTGRES_PASSWORD: self<br>    ports:<br>      - &quot;5432:5432&quot;<br>    volumes:<br>      - &quot;./initDB/townPostgres:/docker-entrypoint-initdb.d&quot;</pre><p>4. <a href="https://ss64.com/osx/osascript.html">Osascript</a> is a script that is used for executing apple script automatically, so it is exclusively used on Mac. The reason why I like to start your local environment using osascript is that you can configure the script to do anything you would normally do on the computer without the terminal even(mimic keyboard keys, mouse clicks, etc), so for example I can set it up to open up a terminal, split the terminal into 3 panels, for each panel, it runs a different service and all that can be done by one command. So the pro is that Osascript is very configurable, the cons are that it is only exclusive to Mac os, also while the script is executing, doing anything manually might disrupt the execution.</p><p>Example script: Here I define a Project folder, open up 3 panels using TMUX, cd to each folder, type in anything I would normally do with keystroke command, and then run code 52 which means enter, it will then run the command and go to the next line. I also put sleep 3 so the panel can finish running the command and then focus on the next panel. You can also find other codes <a href="https://www.codemacs.com/coding/applescript/applescript-key-codes-reference.8288271.htm">here</a>:</p><pre># Folder of your working folder<br>PROJECT_DIR=~/project/test_automate/<br><br>osascript \<br>-e &#39;tell application &quot;iTerm&quot; to activate&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;cd &#39;$PROJECT_DIR&#39;&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;source venv/bin/activate&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;python manage.py runserver localhost:8000&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; <br><br>sleep 3<br><br>osascript \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;d&quot; using command down&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;cd &#39;$PROJECT_DIR&#39;&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;source venv/bin/activate&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;python manage.py runworker&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39;<br><br>sleep 3<br><br>osascript \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;d&quot; using {command down, shift down}&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;cd &#39;$PROJECT_DIR&#39;&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;source venv/bin/activate&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to keystroke &quot;yarn watch:frontend&quot;&#39; \<br>-e &#39;tell application &quot;System Events&quot; to tell process &quot;iTerm&quot; to key code 52&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQGajsfUv47xqfwOYCDsFA.gif" /><figcaption>Easy setup!</figcaption></figure><p>To wrap up, if there is something you do routinely, always try to find ways to optimize it so it is less tedious. Hopefully, these 4 ways are helpful to you as well!</p><h3>Level Up Coding</h3><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://levelup.gitconnected.com/?utm_source=pub&amp;utm_medium=post">Level Up Coding publication</a></li><li>💰 Free coding interview course ⇒ <a href="https://skilled.dev/?utm_source=luc&amp;utm_medium=article">View Course</a></li><li>🔔 Follow us: <a href="https://twitter.com/gitconnected">Twitter</a> | <a href="https://www.linkedin.com/company/gitconnected">LinkedIn</a> | <a href="https://newsletter.levelup.dev/">Newsletter</a></li></ul><p>🚀👉 <a href="https://jobs.levelup.dev/talent/welcome?referral=true"><strong>Join the Level Up talent collective and find an amazing job</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39e9565fb3d5" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/start-your-local-dev-environment-the-fast-way-with-examples-%EF%B8%8F-39e9565fb3d5">Start your local dev environment the fast way, with examples🏎️</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[14 Powerful Visual Studio extensions for full-stack developers]]></title>
            <link>https://levelup.gitconnected.com/14-powerful-visual-studio-extensions-for-full-stack-developers-e502590d5564?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e502590d5564</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[vscode-extension]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Sat, 11 Mar 2023 04:01:36 GMT</pubDate>
            <atom:updated>2023-03-11T16:27:47.007Z</atom:updated>
            <content:encoded><![CDATA[<h3>14 Powerful Visual Studio code extensions for software developers</h3><p>This post is going to be short and sweet, I am going to tell you about 14 powerful extensions that increased my productivity by 10x, hopefully, some of them can also help you as well. Keep in mind that there might be other extensions that do similar things, these are just the ones I found very useful as a Django React Fullstack developer.</p><p>Some of these are self-explanatory but for others, I can provide an example of how I use them, keep in mind they might have more use cases than I can explain in this post, so I also included the link to the marketplace for you to explore further.</p><p>Lastly, this list will be in no particular order. And credit to everyone who created these extensions. Let’s get to the list!</p><p>TL;DR, Extensions: Code Spell Checker, Print Debug, Git Graph, Bookmarks, Copy current file path, Git lens, SQL tools, Version lens, Python, Django test runner, ESlint, Live preview, Auto rename tag, Stlyed-components snippets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4GrzY3YNxxNGr6mYPjIzg.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker">https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker</a></figcaption></figure><ol><li>How many times are you naming a new variable or writing a docstring/comment that you didn’t realize you made a typo and that had to be corrected in the PR review instead? Now there is an extension that helps with that!</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*zCI6h1Z7ela5pbcCpoCbeA.png" /><figcaption>The words in question will be outlined to help you correct the mistake!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCFy4VgtvgjQee4l_Sz4vA.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=ryu1kn.putprint">https://marketplace.visualstudio.com/items?itemName=ryu1kn.putprint</a></figcaption></figure><p>2. There are times as an engineer when you have to debug codes to look for a bug, check for performance issues, etc. There are many ways to help with that but I found the simplest way is through print statements. So instead of typing print(...) or console.log(...) yourself, and then do a bunch of copy and paste, why not automate it?</p><p>You can set up a hotkey to print statements and configure it for each language of your choosing(if the language you use is not in the default settings, you can also play around with config json to add more languages), for me I use control+cmd+x to print numbers in increments, you can also add a specific variable in the print statement if you highlight it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Dznhwk636SS_Qq5OoamnFQ.gif" /><figcaption>I will typically add these statements next to a variable print so I know where the value is on my terminal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K151cWckabg61IULmL3zXA.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph">https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph</a></figcaption></figure><p>3. Sometimes when you either rebase or merge, you might want to know where is your branch in relation to the current master. Well here is a graph to help you visualize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*B7XWT_OPK0TVuZibPFM21A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5LYS7z5mfqs8eR33YYuUfQ.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks">https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks</a></figcaption></figure><p>4. Whenever I finish off the day, it is hard for me to remember where I left off in the code or I might forget some important lines that need further investigation, previously I used to add a comment in the lines I need to look at again, but I found the bookmarking lines of code very useful for the above purposes instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iU66mza-EDgU2w3_G1tipQ.gif" /><figcaption>I will sometimes bookmark also if there is a code snippet I might need for later</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0fa4FMmwLRn8oksq4c0OLA.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=ionceflorin.copy-current-file-path">https://marketplace.visualstudio.com/items?itemName=ionceflorin.copy-current-file-path</a></figcaption></figure><p>5. Sometimes if you need to send a file path to a colleague or use it in one of your commands(ie. python manage.py test {path} ), you might want to make copying the path a little easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*KFkbC-_XGY7lq03mk3cF5A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qA4pmpiU266gqzMl5oN9kQ.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens">https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens</a></figcaption></figure><p>6. This is a very powerful extension that you have to install if you use git at all. There are a lot of functions in this extension but the two functions I use the most are to compare changes and find out who was the last person who last modified the code so I can redirect any question I have for this code to that person.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*Gg4BTmygkPZjCJ6rA9SyVw.gif" /><figcaption>Ah ha, so you are to blame! :p</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAy7Qfj1E-BlcyHRB4qerg.gif" /><figcaption>See what code changed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pdr4YQ-6f5Jp4rcOkmbtlA.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools-driver-pg">https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools-driver-pg</a></figcaption></figure><p>7. This one is a great one that let you connect to your database via VScode, the DB I use is Postgres but the creator has an extension for almost every sort of DB. I use this not only for querying my DB but also because it allows me to look at the table schema in a very easy manner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*p71_Rtbd16uHRTIZlfbBMw.png" /><figcaption>This is what you would see</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_y0C6SKnqeo1qU8zYzTsg.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=pflannery.vscode-versionlens">https://marketplace.visualstudio.com/items?itemName=pflannery.vscode-versionlens</a></figcaption></figure><p>8. This I use mostly to see the latest version of a library, it is definitely easier to do it in VScode than to search it up somewhere else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*One4zvrVa-wxQMWdGFmAhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2iQJLdWemfpoD3kFv0MvQ.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">https://marketplace.visualstudio.com/items?itemName=ms-python.python</a></figcaption></figure><p>9. This is actually a bunch of python related extensions in a bundle, you can take a look at the marketplace link for more information. But the ones I found most helpful are changing environments(auto change to my virtualenv), linting suggestions, and auto code reformatting with yapf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-MsuRSpZTkwuHSjyZt8ofg.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=Pachwenko.django-test-runner">https://marketplace.visualstudio.com/items?itemName=Pachwenko.django-test-runner</a></figcaption></figure><p>10. If you run your Django test cases on a terminal like me, then this extension will be very useful, if you run the Run Tests command, it will run the Django test on the current file, if you highlight a file, it will run the Django test on that class/function only</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hoo8iLJJX67izLygNXiGXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TsI9Yoax1lY1C365vVJE-Q.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint</a></figcaption></figure><p>11. This is a great extension for Javascript/Typescript developers as it allows you to easily fix linting issues automatically or with a command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mcmSpnn04SC_zvYPfINe5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U1Jx1ejzJvUEhnQBlALdww.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.live-server">https://marketplace.visualstudio.com/items?itemName=ms-vscode.live-server</a></figcaption></figure><p>12. This one I use sometimes to allow to easily preview any html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIAD6V8702Ih87M7dE8Elg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_euuZsskcn4Gp1duNtzrrw.png" /></figure><p>13. This one is very self-explanatory, sometime in React or HTML, you have to add a new tag or update the tag, this extension allows the closing tag to change automacically when you change the opening tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*71P0JxgCVb72-nP_V78CZg.gif" /><figcaption>VScode already auto-complete the tag for you, but this extension can help with updating the closing tag if you change the opening tag</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AtpQTL5e-R073xuPdh8YpQ.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=jonkwheeler.styled-components-snippets">https://marketplace.visualstudio.com/items?itemName=jonkwheeler.styled-components-snippets</a></figcaption></figure><p>14. The snippets it generates are very useful for me if you use styled-components in React.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Bpg9RAwWT99oacjFaa_TDA.gif" /><figcaption>By pressing Tab, it will automatically move you to the next input line(variable name -&gt; component name -&gt; CSS)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e502590d5564" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/14-powerful-visual-studio-extensions-for-full-stack-developers-e502590d5564">14 Powerful Visual Studio extensions for full-stack developers</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get a search bar and Elasticsearch set up in your local environment in under 3 minutes]]></title>
            <link>https://levelup.gitconnected.com/get-a-search-bar-and-elasticsearch-set-up-in-your-local-environment-in-under-3-minutes-eddd70f6ebfc?source=rss-e3acbfe82cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/eddd70f6ebfc</guid>
            <category><![CDATA[experiment]]></category>
            <category><![CDATA[local-environment]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[easy-setup]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Richard Luo]]></dc:creator>
            <pubDate>Thu, 02 Mar 2023 05:11:48 GMT</pubDate>
            <atom:updated>2023-03-26T00:38:17.077Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I thought about adding a search bar in an app I am working on that searches for any resource within my app. To play around with Elasticsearch and get a proof of concept going, I decided to use docker to host the Elasticsearch instance and HTML for a simple search bar that calls the Elasticsearch api. And I wanted to share my hassleless setup that removes the need to set up user and password, certificates, and CORS.</p><h3>Prerequisite:</h3><ol><li>Make sure you have a PC that has a terminal to run commands on</li><li>Have Docker installed, you can download docker <a href="https://www.docker.com/">here</a>, and choose what variation to download depending on your PC.</li><li>Optional: Install a REST client like <a href="https://insomnia.rest/download">Insomnia</a>, this should allow you to populate your index and document very easily.</li></ol><h3>Steps:</h3><ol><li>Git clone <a href="https://github.com/ItsRLuo/Elasticsearch/tree/main">here</a> or copy the file to a folder on your computer and use a terminal to cd into that folder</li><li>Run docker network create elastic, this will create a docker network called elastic to be used later</li></ol><p>3. Run the command below, this line will run an Elasticsearch instance that has no CORS check and all security checks disabled. Don’t forget to change{run_folder_path} to your current folder, and you can also change the version of Elasticsearch accordingly to your need.</p><pre>docker run - name es01 - net elastic -p 9200:9200 -v {run_folder_path}/custom_elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -it docker.elastic.co/elasticsearch/elasticsearch:8.6.2</pre><p>4. Optional: Import Insomnia_2023–02–28.json with Insomia or run this line below to get your Elasticsearch populated</p><pre>curl --request POST \<br>--url &#39;http://localhost:9200/_bulk?pretty=&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--data &#39;{ &quot;create&quot; : {&quot;_index&quot; : &quot;test&quot;, &quot;retry_on_conflict&quot; : 3} }<br>{&quot;link&quot;: &quot;http://test.com&quot;, &quot;random_text&quot; : &quot;The way to get started is to quit talking and begin doing. -Walt Disney&quot;}<br>{ &quot;create&quot; : {&quot;_index&quot; : &quot;test&quot;, &quot;retry_on_conflict&quot; : 3} }<br>{&quot;link&quot;: &quot;http://test.com&quot;, &quot;random_text&quot; : &quot;It is during our darkest moments that we must focus to see the light. -Aristotle&quot;}<br>{ &quot;create&quot; : {&quot;_index&quot; : &quot;test&quot;, &quot;retry_on_conflict&quot; : 3} }<br>{&quot;link&quot;: &quot;http://test.com&quot;, &quot;random_text&quot; : &quot;In three words I can sum up everything I&#39;\&#39;&#39;ve learned about life: it goes on. ― Robert Frost&quot;}<br>{ &quot;create&quot; : {&quot;_index&quot; : &quot;test&quot;, &quot;retry_on_conflict&quot; : 3} }<br>{&quot;link&quot;: &quot;http://test.com&quot;, &quot;random_text&quot; : &quot;Without music, life would be a mistake. ― Friedrich Nietzsche, Twilight of the Idols&quot;}<br>{ &quot;create&quot; : {&quot;_index&quot; : &quot;test&quot;, &quot;retry_on_conflict&quot; : 3} }<br>{&quot;link&quot;: &quot;http://test.com&quot;, &quot;random_text&quot; : &quot;It is better to be hated for what you are than to be loved for what you are not. ― Andre Gide, Autumn Leaves&quot;}</pre><p>5. Open test.html on a browser and you are done! All Result shows all the documents on thetest index and when you type anything the result will show in the Search Result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*bncxwJ2mc7bhm2J3AbJ7tQ.gif" /><figcaption>Working as intended!</figcaption></figure><p>Happy experimenting with Elasticsearch!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eddd70f6ebfc" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/get-a-search-bar-and-elasticsearch-set-up-in-your-local-environment-in-under-3-minutes-eddd70f6ebfc">Get a search bar and Elasticsearch set up in your local environment in under 3 minutes</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>