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
// 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 |
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 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({ |
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
// 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!"); | |
}); |
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
// 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) { |
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
// 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' | |
}) |
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
<!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> |
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
<!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> |
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
<!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> |
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
<!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> |
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
// 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") |