

And we're gonna use app.use, and then express.static. Okay, so we're in static assets, and we're gonna look at app.js in here. You should be getting sick of it now, and I'm about to show you how you don't have to do every single time. > Brian Holt: This should be, feel like the familiar pattern. > Brian Holt: Did I, okay, so I have a folder called, let's clear this out. > Male Student 1: So this is one of the things that Express adds, it's not part of > Brian Holt: So, again, it would be extremely painful if this idea of a static asset or a public folder didn't exist. We had to say it was plain text, right? Express is smart enough to figure out what kind of static asset it's serving. And it'll even, you know how we set the content type? And it just makes new routes for all your static assets based on what their file name is. You just say, hey, Express, serve anything in this folder to anyone who asks for it.

So what we do is we take a folder and we me say this folder is now public, right? So anything that's in this folder can be accessed by anyone. It's a huge pain, especially if you have a large site with many, many, many images. We could say app.get smileyface.png serve this smiley face picture to the user. Cuz otherwise, you know how we're saying app.get do this, app.get do this? So we kind of introduced this idea of a static asset or a, something that's called a public directory. You're just, the user's going to say, hey, I need an image. You're not gonna look at them, you're not gonna modify them. They're just files that you're gonna store on your server and then send to the users. So, Static Assets are interesting because they're essentially things that you're going to give to the user that the server's not going to change, right? So this is going to be like HTML, CSS, JavaScript images. Transcript from the "Static Assets" Lesson
