Skip to content

Instantly share code, notes, and snippets.

@Omkaragrawal
Omkaragrawal / postgres-cheatsheet.md
Created December 31, 2018 13:18 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@Omkaragrawal
Omkaragrawal / gist:455b67cc24fa76a91495b728b2df6fb5
Created May 25, 2018 11:08 — forked from jaredhanson/gist:3989193
Node Knockout 2012 - Getting Started with Passport
var express = require('express'),
passport = require('passport'),
TwitterStrategy = require('passport-twitter').Strategy,
ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn,
app = express();
app.use(express.static(__dirname + '/public'));
app.use(express.cookieParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());

Authentication with an Express API and Postgres

Setting Up

Let's make sure our Express app has the required base modules:

# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon