This file contains hidden or 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 express = require("express"); | |
const port = process.env.PORT || 8080; | |
const app = express(); | |
app.enable("trust proxy"); | |
app.use(function(req, res, next) { | |
console.log("inside app use"); | |
if (req.protocol !== "https") { |
This file contains hidden or 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
{ | |
"name": "vue-app", | |
"version": "0.1.0", | |
"private": true, | |
"scripts": { | |
"serve": "vue-cli-service serve", | |
"build": "vue-cli-service build", | |
"postinstall": "npm run build", | |
"start": "node server.js" | |
}, |
This file contains hidden or 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
production: | |
aws: | |
access_key_id: 123 | |
secret_access_key: 345 | |
development: | |
aws: | |
access_key_id: abc | |
secret_access_key: xyz |
This file contains hidden or 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
some_special_variable: secretstuff |
This file contains hidden or 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
alias -g subl=subl | |
PATH=$PATH:/usr/local/bin/; export PATH | |
export PATH=/usr/local/heroku/bin | |
# Exports {{{ | |
export GITHUB_USER="yourgithubusername" | |
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin # Reorder PATH so local bin is first | |
export PATH=$PATH:$HOME/anaconda/bin | |
export GREP_OPTIONS='--color=auto' | |
export GREP_COLOR='1;32' |
This file contains hidden or 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
<template> | |
<div> | |
<h2>Register</h2> | |
<form @submit.prevent="submitRegistration"> | |
<div> | |
<input type="text" v-model="email"> | |
</div> | |
<div> |
This file contains hidden or 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
class RegistrationsController < ApplicationController | |
include AuthTokenConcern | |
def create | |
user = User.create!( | |
email: params['user']['email'], | |
password: params['user']['password'], | |
password_confirmation: params['user']['password_confirmation'], | |
auth_token: unique_auth_token | |
) |
This file contains hidden or 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
module AuthTokenConcern | |
extend ActiveSupport::Concern | |
included do | |
before_action :unique_auth_token | |
end | |
def unique_auth_token | |
unique_auth = false | |
while unique_auth == false |
This file contains hidden or 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
Rails.application.routes.draw do | |
post 'register_user' => 'registrations#create' | |
end |
This file contains hidden or 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
class User < ApplicationRecord | |
has_secure_password | |
validates_uniqueness_of :email | |
end |