Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MERN Quick Start Guide

You're reading from   MERN Quick Start Guide Build web applications with MongoDB, Express.js, React, and Node

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781787281080
Length 302 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Eddy Wilson Iriarte Koroliova Eddy Wilson Iriarte Koroliova
Author Profile Icon Eddy Wilson Iriarte Koroliova
Eddy Wilson Iriarte Koroliova
Arrow right icon
View More author details
Toc

Table of Contents (8) Chapters Close

Preface 1. Introduction to the MERN Stack 2. Building a Web server with ExpressJS FREE CHAPTER 3. Building a RESTful API 4. Real-Time Communication with Socket.IO and ExpressJS 5. Managing State with Redux 6. Building Web Applications with React 7. Other Books You May Enjoy

Using ExpressJS' built-in middleware function for serving static assets

Prior to the 4.x version of ExpressJS, it has depended on ConnectJS which is an HTTP server framework https://github.com/senchalabs/connect. In fact, most middleware written for ConnectJS is also supported in ExpressJS.

As from the 4.x version of ExpressJS, it no longer depends on ConnectJS, and all previously built-in middleware functions were moved to separate modules https://expressjs.com/en/resources/middleware.html.

ExpressJS 4.x and newer versions include only two built-in middleware functions. The first one has already been seen: the built-in error handler middleware function. The second one is the express.static middleware function that is responsible for serving static assets.

The express.static middleware function is based on serve-static module https://expressjs.com/en/resources/middleware...

You have been reading a chapter from
MERN Quick Start Guide
Published in: May 2018
Publisher: Packt
ISBN-13: 9781787281080
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime