Skip to content

Instantly share code, notes, and snippets.

View mckiersey's full-sized avatar

Sean McKiernan mckiersey

View GitHub Profile
// LINK TO DATABASE CONNECTION
const pool = require('./config.js')
var path = require("path");
// google auth
const { OAuth2Client } = require('google-auth-library');
const CLIENT_ID = '170958026096-1delfs3g8tg4hoeg6bgs5ickhpe7k5pt.apps.googleusercontent.com' // Given by Google when you set up your Google OAuth client ID: https://developers.google.com/identity/sign-in/web/sign-in
//VERIFICATION FUNCTION: The ticket inspector
const express = require('express');
const app = express();
const port = 80;
const path = require('path');
const routes = require('./routes.js');
const bodyParser = require('body-parser')
// Add body parser for routes.js file
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
// LINK TO DATABASE CONNECTION
const pool = require('./config.js')
// DEFINE APP
const router = app => {
app.get('/', (request, response)=> {
response.send("So this message is coming from your app, which is also known as your server!");
});
// Add this inside the closing brace } of line 29 above, so that it's all part of the onSignIn function
// POST NEW USER TO BACK END;
console.log('new user is:', userName,'the email is: ', userEmail, 'and the picture is', image)
var postUrl = `http://localhost:80/newUser`
// Send the data using post;
try{
console.log('trying to send ot back end')
$.post(postUrl, { userName: userName, userEmail: userEmail, userProfilePicture: image })
.done(function (data) {
@mckiersey
mckiersey / config.js
Created January 17, 2021 12:16
Here we configure the connection to our database
// source tutorial: https://mhagemann.medium.com/create-a-mysql-database-middleware-with-node-js-8-and-async-await-6984a09d49f4
// NOTE: If using git, put this file into gitignore- these configuration details are security sensitive.
var mysql = require('mysql')
var pool = mysql.createPool({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'root',
database: 'fullstack_db'
})
<!DOCTYPE html>
<html>
<head>
<title>Web dev for absolute beginners</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="170958026096-1delfs3g8tg4hoeg6bgs5ickhpe7k5pt.apps.googleusercontent.com">
</head>
<body>
<h1>Full stack front end dev</h1>
<!DOCTYPE html>
<html>
<head>
<title>Web dev for absolute beginners</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="170958026096-1delfs3g8tg4hoeg6bgs5ickhpe7k5pt.apps.googleusercontent.com">
</head>
<body>
<h1>Full stack front end dev</h1>
<!DOCTYPE html>
<html>
<head>
<title>Web dev for absolute beginners</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="111444900791603213415.apps.googleusercontent.com">
</head>
<body>
<h1>Full stack front end dev</h1>
<!DOCTYPE html>
<html>
<head>
<title>Web dev for absolute beginners</title>
</head>
<body>
<h1>Full stack front end dev</h1>
<p1>First step towards your website- nice one!</p1>
<h2>Adding content to our website</h2>
@mckiersey
mckiersey / routes_with_html.js
Created January 7, 2021 19:59
routes file now with html
// DEFINE APP
const router = app => {
app.get('/', (request, response)=> {
response.send("So this message is coming from your app, which is also known as your server!");
});
app.get('/home', (request, response)=>{
response.sendFile("/Users/Seansmac/Desktop/Dev/Full_stack_for_absolute_beginners/myrepo/FullStackDev/homepage.html")