From the course: Express Essentials: Build Powerful Web Apps with Node.js
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Serving static files with Express
From the course: Express Essentials: Build Powerful Web Apps with Node.js
Serving static files with Express
- [Instructor] In addition to using Express to query and fetch data from APIs, you can also use express to serve static files. Static files, in this case, are files that are not going to change. So typically you might serve files like photos, PDFs, document files, but you can also serve more development specific files like HTML and CSS files. If you take a look at the exercise files for this course, you should see a folder labeled static_files. In this folder, there are two images: mountains_1 and mountains_2. We are going to serve up these photos, which are examples of static files using our Express project. I'm going to show you two different ways to accomplish this. Let's go ahead and get started in our VS Code. The first thing that we're going to do is create a new folder at the root of our project called public. You can create your folder in a few ways. If you want to use the command line to do so, please feel…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Getting started: Server and project setup16m 24s
-
(Locked)
Mock data is served: Adding data to your server6m 34s
-
(Locked)
What are HTTP methods and routes?8m 34s
-
(Locked)
Postman: A free tool for testing4m 28s
-
(Locked)
Let's GET some data: Creating a basic data endpoint2m 37s
-
(Locked)
Serving static files with Express6m 36s
-
-
-
-
-