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
// We need to create a bunch of variables to set up the server | |
// const is (one of the ways) to create variables in javascript | |
const express = require('express'); | |
const app = express(); | |
const port = 80; | |
const path = require('path'); |
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 server = app.listen(port, (error) => { | |
if(error) return console.log(`** SERVER ERROR: ${error}`); | |
console.log(`Server is running on port: ${server.address().port}`) | |
}); |
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'); | |
//start the server | |
const server = app.listen(port, (error) => { |
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!"); | |
}); | |
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") |
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
<!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> | |
<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
// 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' | |
}) |
OlderNewer