-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a316651
commit ed2b1cc
Showing
12 changed files
with
161 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function handleSubmit(event) { | ||
event.preventDefault() | ||
|
||
// check what text was put into the form field | ||
let formText = document.getElementById('name').value | ||
checkForName(formText) | ||
|
||
console.log("::: Form Submitted :::") | ||
fetch('http:https://localhost:8080/test') | ||
.then(res => res.json()) | ||
.then(function(res) { | ||
document.getElementById('results').innerHTML = res.message | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function checkForName(inputText) { | ||
console.log("::: Running checkForName :::", inputText); | ||
let names = [ | ||
"Picard", | ||
"Janeway", | ||
"Kirk", | ||
"Archer", | ||
"Georgiou" | ||
] | ||
|
||
if(names.includes(inputText)) { | ||
alert("Welcome, Captain!") | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
min-height: 100vh; | ||
} | ||
|
||
main { | ||
flex: 2; | ||
} | ||
|
||
section { | ||
max-width: 800px; | ||
margin: 50px auto; | ||
} |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
form { | ||
border: 1px solid #545454; | ||
border-radius: 3px; | ||
padding: 40px; | ||
} | ||
|
||
input { | ||
padding: 5px 20px; | ||
width: 100%; | ||
line-height: 16px; | ||
margin: 10px 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
header { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 10px 40px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* http:https://meyerweb.com/eric/tools/css/reset/ | ||
v2.0 | 20110126 | ||
License: none (public domain) | ||
*/ | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
html, body, div, span, applet, object, iframe, | ||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
a, abbr, acronym, address, big, cite, code, | ||
del, dfn, em, img, ins, kbd, q, s, samp, | ||
small, strike, strong, sub, sup, tt, var, | ||
b, u, i, center, | ||
dl, dt, dd, ol, ul, li, | ||
fieldset, form, label, legend, | ||
table, caption, tbody, tfoot, thead, tr, th, td, | ||
article, aside, canvas, details, embed, | ||
figure, figcaption, footer, header, hgroup, | ||
menu, nav, output, ruby, section, summary, | ||
time, mark, audio, video { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, aside, details, figcaption, figure, | ||
footer, header, hgroup, menu, nav, section { | ||
display: block; | ||
} | ||
body { | ||
line-height: 1; | ||
} | ||
ol, ul { | ||
list-style: none; | ||
} | ||
blockquote, q { | ||
quotes: none; | ||
} | ||
blockquote:before, blockquote:after, | ||
q:before, q:after { | ||
content: ''; | ||
content: none; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
ul { | ||
list-style-type: none; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
var path = require('path') | ||
const express = require('express') | ||
const mockAPIResponse = require('./mockAPI.js') | ||
|
||
const app = express() | ||
app.use(express.static('src/public')); | ||
|
||
var json = { | ||
'title': 'test json response', | ||
'message': 'this is a message', | ||
'time': 'now' | ||
} | ||
app.use(express.static('src/client')) | ||
|
||
app.get('/', function (req, res) { | ||
res.sendFile('/views/index.html', { root: __dirname }); | ||
}) | ||
console.log(__dirname) | ||
|
||
app.get('/test', function (req, res) { | ||
res.send(json); | ||
app.get('/', function (req, res) { | ||
res.sendFile('/client/views/index.html', { root: __dirname + '/..' }) | ||
}) | ||
|
||
// designates what port the app will listen to for incoming requests | ||
app.listen(3000, function () { | ||
app.listen(8080, function () { | ||
console.log('Example app listening on port 3000!') | ||
}) | ||
|
||
app.get('/test', function (req, res) { | ||
res.send(mockAPIResponse) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let json = { | ||
'title': 'test json response', | ||
'message': 'this is a message', | ||
'time': 'now' | ||
} | ||
|
||
module.exports = json |