Video 46: Serving up CSS, JS, Impages, and More
This commit is contained in:
parent
8f136ffed8
commit
e393438dd1
@ -1,8 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>About</h1>
|
||||
<img src="/img/me.jpg">
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
7
web-server/public/css/styles.css
Normal file
7
web-server/public/css/styles.css
Normal file
@ -0,0 +1,7 @@
|
||||
h1 {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 250px;
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Help</h1>
|
||||
</body>
|
||||
|
||||
</html>
|
BIN
web-server/public/img/me.jpg
Normal file
BIN
web-server/public/img/me.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 677 KiB |
@ -1,8 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/styles.css">
|
||||
<script src="/js/app.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>From a static file</h1>
|
||||
</body>
|
||||
|
||||
</html>
|
1
web-server/public/js/app.js
Normal file
1
web-server/public/js/app.js
Normal file
@ -0,0 +1 @@
|
||||
console.log('Client side javascript file is loaded!')
|
@ -8,7 +8,7 @@ app.use(express.static(publicDirectoryPath))
|
||||
|
||||
app.get('/weather', (req, res) => {
|
||||
res.send({
|
||||
forecast: 'It\'s snowing. It\'s really gross out.',
|
||||
forecast: 'It is snowing. In September.',
|
||||
location: 'Calgary'
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user