git clone https://github.com/therobinkim/express-serve-static-files.git
cd express-server-static-files
cd original
orcd alternate
npm install
npm start
- Open http://localhost:8080/public.html and http://localhost:8080/static.html; if the text appears in two different colors, then all of the static assets are being loaded correctly. (You can also open your DevTools to check for the JavaScript
console.log
statements.) - When you switch between the original and alternate implementations, make sure you shut down your
npm start
script from the implementation you were just looking at.
This repo was created to help support my StackOverflow answer at https://stackoverflow.com/a/48298000/3814251.