Skip to content

Commit c6e331e

Browse files
authored
feat: created a server containing lesson_22 files and alterations alongside node express and various package additions for Feature/lesson_24 (#577)
* feat: adds joseph's_template folder with copied files of template folder, modifies only the styles.css inside joseph's_template folder. lesson_22 -JosephCaballero * feat: modifies styles.css to enhance webpage * modifies styles.css inside joseph's template. working on 'buttons' in the programs section * modifies styles.css in josephs_template folder. highlights the 'buttons'. lesson_22 -JosephCaballero * feat: modifies styles.css more and index.html breifly. adds index.js files and packages inside package.json/package-lock.json. adds folder to hold files being used in index.js. lesson_24 -JosephCaballero * fix: deletes extra file. lesson_24 -JosephCaballero * chore: gets rid of boilterplate code and deleted some javadocs i want to expand on into the future. lesson_24 -JosephCaballero * chore: moves folder from lesson_22 into lesson_24. lesson_24 -JosephCaballero
1 parent 1ea9242 commit c6e331e

File tree

7 files changed

+2236
-0
lines changed

7 files changed

+2236
-0
lines changed

lesson_24/josephs_template/index.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
const morgan = require("morgan");
2+
const path = require("path");
3+
var debug = require('debug')('myapp:server');
4+
const bodyParser = require('body-parser');
5+
const express = require("express")
6+
7+
const PORT = process.env.PORT || 5500;
8+
const app = express()
9+
10+
app.use(morgan("dev"));
11+
app.use(express.static(path.join(__dirname, "public")));
12+
app.use(bodyParser.urlencoded({ extended: true}));
13+
14+
15+
app.post('/signUp.html', (req, res) =>{
16+
res.status(200).send(`
17+
<title>Sign Up Page</title>
18+
<div>
19+
<div id="grid">
20+
<div id="holder">
21+
<form action="/signUp2.html" method="POST">
22+
<input name="nameInput" id="myInput" type="text" placeholder="Enter Full Name" required>
23+
<input name="emailInput" type="email" placeholder="Email Address">
24+
<button>
25+
Submit Form
26+
</button>
27+
</form>
28+
<form action="index.html" method="GET">
29+
<button>
30+
Back to main page
31+
</button>
32+
</form>
33+
</div>
34+
</div>
35+
</div>
36+
37+
<style>
38+
body {
39+
background-color: #880808;
40+
}
41+
form{
42+
display: flex;
43+
flex-direction: column;
44+
justify-content: center;
45+
align-items: center;
46+
}
47+
48+
#grid{
49+
display: grid;
50+
grid-template-columns: 33.3% 33.3% 33.3%;
51+
grid-template-rows: 50% 50% 50%;
52+
}
53+
54+
#holder{
55+
grid-column-start: 2;
56+
grid-row-start: 2;
57+
}
58+
59+
input{
60+
text-align: center;
61+
padding: 1em 1.5em;
62+
border-radius: 9em;
63+
background: linear-gradient(to left, #333, #333 50%, #eee 100%, #333 85%);
64+
font: 700 1.5em / 1.25 ubuntu, sans-serif;
65+
text-transform: uppercase;
66+
margin: 10px;
67+
}
68+
button:hover{
69+
cursor: pointer;
70+
}
71+
72+
button{
73+
text-align: center;
74+
padding: 1em 1.5em;
75+
border-radius: 9em;
76+
background: linear-gradient(to left, #333, #333 50%, #eee 100%, #333 85%);
77+
font: 700 1.5em / 1.25 ubuntu, sans-serif;
78+
text-transform: uppercase;
79+
}
80+
</style>
81+
`);
82+
});
83+
app.post('/signUp2.html', (req, res) => {
84+
const nameInput = req.body.nameInput;
85+
console.log(nameInput);
86+
const emailValue = req.body.emailInput;
87+
res.status(200).send(`
88+
<title>Retrieval Page</title>
89+
<div style="display: flex; justify-content: center; ">
90+
<form action="signUp.html" method="POST">
91+
<br>
92+
<button>
93+
Return back to page
94+
</button>
95+
</form>
96+
</div>
97+
<div style="display: flex; flex-direction: column; padding:0px" >
98+
<h1>You have submitted good job <br/>
99+
The information you put in: <br/> ${nameInput}<br/> ${emailValue}</h1>
100+
</div>
101+
<style>
102+
h1{
103+
text-align: center;
104+
background-color: gray;
105+
}
106+
body{
107+
background-color: #880808;
108+
}
109+
110+
button{
111+
display: grid;
112+
grid-auto-flow: column;
113+
grid-gap: .5em;
114+
padding: 1em 1.5em;
115+
border-radius: 9em;
116+
background: linear-gradient(to left, #333, #333 50%, #eee 100%, #333 85%);
117+
font: 700 1.5em / 1.25 ubuntu, sans-serif;
118+
text-transform: uppercase;
119+
}
120+
121+
button:hover{
122+
cursor: pointer;
123+
}
124+
</style>
125+
`);
126+
})
127+
128+
app.listen(PORT, () => {
129+
console.log(PORT);
130+
debug(`Server listening on http://localhost:${PORT}`);
131+
});

0 commit comments

Comments
 (0)