From the course: Node.js: Web Servers, Tests, and Deployment
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
File servers with serve - Node.js Tutorial
From the course: Node.js: Web Servers, Tests, and Deployment
File servers with serve
- [Instructor] Earlier in this course, we built an HTTP server capable of serving web files over HTTP. We had to handle file requests for each type of file and respond with the appropriate headers and content. It was a tedious task to build a file server with the core HTTP module, but we know it can be done. We know how to do it. However, when it comes time to get your work done, we can rely on the NPM community. There are a number of file servers that can serve static files over HTTP. What we have here inside of our start file, we have a folder called client. It looks like the front end team delivered a client web application that's ready to go. If we want to take a look at these files, we need to serve them over HTTP with a web server. So there's actually a module that can help us do this. Now, one way that we can run certain types of packages is we can run a command called NPX. This is Node JSs and NPMs file runner…
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.