1
0

Video 46: Serving up CSS, JS, Impages, and More

This commit is contained in:
Jason Williams 2019-09-30 11:17:07 -06:00
parent 8f136ffed8
commit e393438dd1
7 changed files with 31 additions and 6 deletions

View File

@ -1,8 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="/css/styles.css">
</head> </head>
<body> <body>
<h1>About</h1> <h1>About</h1>
<img src="/img/me.jpg">
</body> </body>
</html> </html>

View File

@ -0,0 +1,7 @@
h1 {
color: grey;
}
img {
width: 250px;
}

View File

@ -1,8 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="/css/styles.css">
</head> </head>
<body> <body>
<h1>Help</h1> <h1>Help</h1>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 KiB

View File

@ -1,8 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="/css/styles.css">
<script src="/js/app.js"></script>
</head> </head>
<body> <body>
<h1>From a static file</h1> <h1>From a static file</h1>
</body> </body>
</html> </html>

View File

@ -0,0 +1 @@
console.log('Client side javascript file is loaded!')

View File

@ -8,7 +8,7 @@ app.use(express.static(publicDirectoryPath))
app.get('/weather', (req, res) => { app.get('/weather', (req, res) => {
res.send({ res.send({
forecast: 'It\'s snowing. It\'s really gross out.', forecast: 'It is snowing. In September.',
location: 'Calgary' location: 'Calgary'
}) })
}) })