Skip to content

Commit 137eb0f

Browse files
authored
feat: adds Dylan's express demo clone (#570)
* feat: Adds navbar, hero section, and a grid for content * Feat: Completes hero-section * feat: Adds footer and completes programs, adds responsive layout * feat: adds keyframes for hero-text TODO: fix keyframes so only text * fix: fixes grid error and fixes hero-text * feat: adds footer responsiveness * feat: creates file structure and gets a hello world running * feat: successfully created a route to the contacts page * feat: creates contact page * feeat: deletes lesson 22 work from this branch * feat: creates a basic layout for the contact us page * feat: takes form submission from contact page and sends you to a new page * fix: centers footer on newcontact.ejs * chore: removes bad comments and also puts images into folder * fix: fixes image in newcontact.ejs * fix: fixes shadow and programs section throughout website
1 parent 7b5acea commit 137eb0f

File tree

11 files changed

+2387
-0
lines changed

11 files changed

+2387
-0
lines changed

lesson_24/dylanlafferty/index.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const express = require('express')
2+
const morgan = require("morgan")
3+
const path = require("path")
4+
var debug = require('debug')('dylanlafferty:server')
5+
6+
const app = express()
7+
8+
app.set("view engine", "ejs")
9+
app.set("views", path.join(__dirname, "views"));
10+
11+
//Sets morgan middleware
12+
app.use(morgan("dev"))
13+
14+
//this will get the files from public
15+
app.use(express.static(path.join(__dirname,"public")))
16+
app.use(express.urlencoded({ extended: true }))
17+
18+
const PORT = process.env.PORT || 3000
19+
20+
//we can get put post delete or patch with app
21+
//Route take in a request and a response req res
22+
//send data res.send("Hi")
23+
24+
app.get('/', (req, res) => {
25+
console.log("here")
26+
res.render("contact")
27+
})
28+
29+
const contactRouter = require('./routes/contact-us')
30+
31+
app.use("/contact-us", contactRouter)
32+
33+
app.post("/", (req, res) => {
34+
res.render("")
35+
})
36+
37+
app.listen(PORT, () => {
38+
debug(`Example app listening on port ${PORT}`)
39+
})

0 commit comments

Comments
 (0)