Category: Uncategorized

  • Passing a Programming Behavioral Interview or Screen

    Today I met someone who is interviewing for SWE roles but struggling to make it past recruiter screens. When I asked what types of questions they are asking he replied with the one that’s been tripping him up. "Tell me about a time where you ran into conflict in your work and how did you…

  • Node Postgres Insert Multiple Rows

    You might be wondering how to insert multiple rows into a table using Node Postgres. Most examples show adding only one row at a time. Some solutions recommend using a control flow library like async. But this technique is slow and inefficient because it uses too many connections or sends the queries one by one.…

  • Async Await for Passport.js Authentication in Express.js

    The goal of this blog post is for you to know exactly how to implement the LocalStrategy for PassportJS using async/await patterns in your express.js application. In the passport.js documentation one of the first steps to getting started is to implement your first "strategy" and register it with passport. var passport = require(‘passport’) , LocalStrategy = require(‘passport-local’).Strategy;…

  • How to use transactions with node postgres

    Transactions in computer programming are essential for data integrity. Transactions provide primitives for guaranteeing your query logic succeeds or fails gracefully. A transaction contains any number of statements. At any point you can rollback if an error occurs or your logic fail conditions trigger. A RDBMS like PostgreSQL gives you an amazing set of properties…

  • Node Postgres Example

    This tutorial shows how to connect and query Postgres using Node. For this project we assume you have a Mac or Linux machine, know git, know node.js, and some SQL. Contents Setup Create Database Connections Query Advanced Queries Setup Project Clone Example Project git clone git@github.com:wlaurance/node-postgresql-example.git The example code is available at the Github repo…

  • NGINX Rewrite Subdomain to Path

    In this post I show you how to rewrite subdomain requests to a path. This is a common requirement if a client or business wants to change a blog or API domain name scheme. We will change blog.mydomain.com and api.mydomain.com to mydomain.com/blog and mydomain.com/api respectively. | Old Route | ==> | New Route | |————-|—–|—————————————-| | blog.mydomain.com | ==> | mydomain.com/blog | | api.mydomain.com | ==> | mydomain.com/api | #This server…

  • How To NGINX reverse proxy to another server

    Why would you want to use the proxy_pass directive? You are a high school student. Your school blocks access to social networks. You want to sell Facebook.com proxy access to your classmates for five dollars a month. You can use NGINX to proxy HTTP traffic from an IP address you control to the Facebook.com domain. Make sure…

  • Using PostgreSQL and Node

    I’m using node-postgres, node-sql, and node-db-migrate to build a time tracking API, currently named tempus and it’s a wonderful experience. Most people new to node will see enterprise stacks like mean.io and only be exposed to the NoSQL paradigm for their persistent storage options. This is not the only option! Yes, relational databases are still a thing and many companies use them. Even trendy startups like instagram! I…