Creating a Single Page Web App Development Environment
Whenver I build NodeJS apps, I use nodemon as my server and file watch. Nodemon is simple and easy to use but when it comes to serving a single
index.html, I prefer http-server.
http-server is an NPM package that helps you spin up a server to serve a single HTML file.
Instead of hitting refresh on a URL that looks like this:
It can look like this:
Or like this:
Running a single web page through a server is useful in situations where you're configuring callbacks, allowed web origins or CORS.
Step 1 - Download HTML5 Boilerplate
HTML5 Boilerplate is all you need to get you started.
Step 2 - Install HTTP-SERVER
If you have NPM installed, try this:
npm -i http-server
Step 3 - Start Your Server
http-server is a command-line HTTP server so all it takes is a single command.
Start server on a specific port.
http-server -p 3000