//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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
); |
-
log into aws console https://console.aws.amazon.com/
-
go to aws cloud 9 https://console.aws.amazon.com/cloud9/
-
create new environment (use all defaults)
-
Copy and paste each command (one at a time) in the console which is provided
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"env": { | |
"browser": true, | |
"commonjs": true, | |
"es6": true, | |
"node": true | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const exchangeTokenForAuth = (history)=> { | |
return (dispatch)=> { | |
const token = window.localStorage.getItem('token'); | |
if(!token){ | |
return | |
} | |
return axios.get('/api/auth', { | |
headers: { | |
authorization: token | |
} |