Node.js Tutorials

  • By
    Get and Set Environment Variables in Node.js

    One of the best ways to use sensitive information in open source repositories without hard-coding the information within publicly available repositories is setting environment variables.  Set the environment variables on the server, retrieve them by key within your application. When using Node.js, you can retrieve environment variables by key from the process.env object: There...

  • By
    Intercept HTTP Requests with Node.js nock

    Unit testing external APIs is difficult no matter what language you do it in.  Hell, working with any external API is scary, if only because you have zero control of networking issues, API changes, and a host of other issues.  But if you do create a service...

  • By
    Get Node.js Command Line Arguments with yargs

    Using command line arguments within Node.js apps is par for the course, especially when you're like me and you use JavaScript to code tasks (instead of bash scripts).  Node.js provides process.argv but that doesn't provide a key: value object like you'd expect: Bleh.  If you want to work with a...

  • By
    CanIUse Command Line

    Every front-end developer should be well acquainted with CanIUse, the website that lets you view browser support for browser features.  When people criticize my blog posts for not detailing browser support for features within the post, I tell them to check CanIUse:  always up to date, unlike...

  • By
    Serve a Directory with Node.js

    As I mentioned in Serve a Directory with Python, sometimes you need a directory to be "served" instead of loading the file:// location within your browser.  In the past I would mess around with MAMPStack and swapping out httpdocs directories, but there are better tools these...

  • By
    Loading Static Templates for Intern Testing

    I use Intern by SitePen for all of my JavaScript functional testing.  Intern has loads of features other functional test frameworks don't and it's completely Promise-based -- something I got very used to when I used the Dojo Toolkit every day. Async test creation can...

  • By
    Resize an Animated GIF

    Animated GIFs are images but you can't really handle them link other types of images, like PNGs or JPEGs or even WebPs.  GIFs are kind of a video file, because they have frames, but there's no real control over how they play or loop.  My favorite image...

  • By
    Prevent Animated GIFs from Looping

    We all know animated GIFs put the "fun" in "functional." I've recently written incredible posts with regard to animated GIF images, including: Detect if a GIF is Animated Merge GIFs with gifsicle Optimize GIF Images Convert Video to GIF or GIF to Video Get the...

  • By
    Get Bitcoin Value with curl or Node.js

    Last year I started dabbling in bitcoin.  Of course I was immediately cocky as bitcoin value went up 20% as soon as I bought it, then was humbled as bitcoin's value tumbled down 50%.  From boathouse to outhouse.  From caviar to ramen noodles.  It was brutal. Anyways, I was...

  • By
    Get Open Graph Data with Node.js

    Two of this blog's most popular posts are Facebook Open Graph META Tags and How to Create a Twitter Card.  I'm not at all surprised because we as content creators want some visual control over how our site is represented and shared on third party sites, especially social media...