Skip to content

Instantly share code, notes, and snippets.

const pg = require('pg');
try {
//in secret.js add the following
//process.env.DATABASE_URL = 'YOUR_SECURE_REMOTE_CONNECTION_STRING';
//ADD secret.js to your .gitignore for security
require('./secret');
}
catch(ex){
console.log(ex);
}
DROP TABLE IF EXISTS ownership;
DROP TABLE IF EXISTS sneakers;
DROP TABLE IF EXISTS brands;
DROP TABLE IF EXISTS collectors;
CREATE TABLE brands(
id INTEGER PRIMARY KEY,
name VARCHAR(100)
);
//app
const express = require('express');
const app = express();

//sequelize
const Sequelize = require('sequelize');
const conn = new Sequelize(process.env.DATABASE_URL || 'postgres://localhost/acme_db');
const User = conn.define('user', {
 name: Sequelize.STRING
@ericpkatz
ericpkatz / seven-commands-to-brand-new-environment.md
Last active March 10, 2024 13:39
Cloud 9 - Setting Up Full Stack Environment by installing postgres and setting up credentials with github

create AWS Account

create Cloud9 Environment - Use Defaults

whoami - notice you are the ec2-user

whoami

go into sudo mode

sudo -i
@ericpkatz
ericpkatz / .eslintrc
Created January 4, 2019 22:05
.eslintrc
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
@ericpkatz
ericpkatz / store.js
Created October 1, 2018 10:58
Client Side Thunks for Token Exchange
const exchangeTokenForAuth = (history)=> {
return (dispatch)=> {
const token = window.localStorage.getItem('token');
if(!token){
return
}
return axios.get('/api/auth', {
headers: {
authorization: token
}