Skip to content

Commit b2db0da

Browse files
authored
feat: adds and modifies josephs_otherTemplate in lesson_24 folder to set up a server in the index.js file. This time using ejs and the "modern" way to do servers. lesson_24/Second_PR. -JosephCaballero (#595)
* feat: adds and modifies josephs_otherTemplate in lesson_24 folder to set up a server in the index.js file. This time using ejs and the modern way to do servers. lesson_24. -JosephCaballero * Merge branch 'main' of https://github.com/Josephcabs/code-differently-24-q4 into feature/lesson_24-2
1 parent 7b19dde commit b2db0da

File tree

9 files changed

+2247
-0
lines changed

9 files changed

+2247
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
app.set("view engine", "ejs");
10+
11+
app.use(morgan("dev"));
12+
app.use(express.static(path.join(__dirname, "public")));
13+
app.use(bodyParser.urlencoded({ extended: true}));
14+
15+
app.post('/signUp', (req, res) =>{
16+
res.status(200);
17+
res.render('signUp');
18+
});
19+
20+
app.post('/retrieval', (req, res) => {
21+
const nameInput = req.body.nameInput;
22+
const emailValue = req.body.emailInput;
23+
console.log("hi")
24+
res.render('retievalPage', {emailValue, nameInput});
25+
})
26+
27+
app.listen(PORT, () => {
28+
console.log(PORT);
29+
debug(`Server listening on http://localhost:${PORT}`);
30+
});

0 commit comments

Comments
 (0)