Latest Tutorials

Learn about the latest technologies from fellow newline community members!

  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL
  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL

    Installing dotenv: A Step-by-Step Guide

    When it comes to managing environment variables in a Node.js application, no tool is more favored than dotenv . This lightweight module simplifies loading environment variables, making it a go-to for developers looking to streamline their configuration process. In this blog post, we’ll explore how to install and use dotenv efficiently. dotenv is a zero-dependency module that loads environment variables from a .env file into process.env in Node.js applications. It allows you to keep sensitive data — like API keys and database URLs — out of your codebase. If you haven't already set up a Node.js project, you can create one with the following commands:

      Using pip to install dotenv: Simplifying Environment Variables in Python

      Managing configuration settings and sensitive data in your applications can be daunting. This is where dotenv comes into play. It's a powerful package that helps developers manage environment variables seamlessly, especially when working on Python projects. In this post, we'll delve into the core functionalities of dotenv, its installation via pip, and practical examples to show how you can leverage it for your applications. At its core, python-dotenv is a Python package that enables you to load environment variables from a .env file. These variables can include API keys, database URLs, or any sensitive information that you don't want hard-coded into your source code. By using a .env file, you not only keep your credentials secure but also make your application more configuration-friendly. Imagine switching from development to production without changing the code; this is the beauty of dotenv!

      I got a job offer, thanks in a big part to your teaching. They sent a test as part of the interview process, and this was a huge help to implement my own Node server.

      This has been a really good investment!

      Advance your career with newline Pro.

      Only $40 per month for unlimited access to over 60+ books, guides and courses!

      Learn More

        Environmental Variables in Python: A Guide to load_dotenv

        In software development, configuring your environment carefully is crucial. Be it for a small-scale hobby project or a large enterprise application, the responsible handling of environment variables is essential for maintaining secure and robust applications. If you're a Python developer, the load_dotenv function from the python-dotenv package is your go-to tool for managing these configurations effortlessly. Let's delve into how you can leverage this tool to manage your project's environment settings effectively. Environment variables store configuration settings outside your codebase, enabling you to: First things first, ensure you have the python-dotenv package installed. You can add it to your project using pip:

          When to use double quotes with dotenv

          When developing applications, you often find yourself managing configuration settings that need to be kept separate from your codebase for security and flexibility. Enter dotenv — a tool that helps developers manage environment variables using a simple syntax. But why does it matter how we represent strings, especially in regards to double quotes? Let's dive into the nuances of dotenv and understand the importance of quoting in configuration files. The dotenv library allows you to load environment variables from a .env file into your application. This file is essentially a simple text file containing key-value pairs. Here’s a basic example: In this example, the values are straightforward, but things can get a little tricky when you introduce special characters, spaces, or strings that must be wrapped.

            How to: dotenv in Express.js

            Managing configuration settings securely is a cornerstone of building applications that are not only scalable, but also maintainable. In the Node.js ecosystem, particularly when using frameworks like Express.js, the dotenv package is a tool that allows developers to manage environment variables in a cleaner and more secure manner. In this post, we will explore how to effectively integrate dotenv in an Express app, ensuring our sensitive configurations remain safe and our codebase clear. dotenv is a zero-dependency npm package that loads environment variables from a .env file into process.env . This file is typically excluded from version control (like Git) using a .gitignore file to prevent sensitive data, such as API keys and database credentials, from being publicly exposed. Now, let’s dive into how to set up and use dotenv within an Express.js application.