Single Page App Development Server

1.12.0 · active · verified Sun Apr 19

angular-http-server is a lightweight command-line interface (CLI) development server designed specifically for Single Page Applications (SPAs) such as those built with Angular, React, or Vue. Its primary function is to serve static assets while routing all non-existent file requests back to the application's `index.html` file, enabling client-side routing without 404 errors. Currently at version 1.12.0, it is actively maintained and provides essential features for local development like custom port assignment, automatic browser opening, HTTPS with self-signed certificates, CORS enablement, and a basic HTTP proxy. It explicitly states it is not intended for production use, focusing solely on streamlining the development workflow by abstracting away complex server configurations for SPA development.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates global installation and starting the server with common development options like custom port, auto-open, HTTPS, and CORS.

# Install angular-http-server globally to make it available as a command.
# This is typically a one-time setup for development.
npm install -g angular-http-server

# Navigate into your Single Page Application's build output directory.
# This is usually the 'dist' folder generated by your build process (e.g., Angular CLI, Webpack).
cd /path/to/your/project/dist

# Start the server with common development options:
# -p 8080: Specifies port 8080.
# --open: Automatically opens the application in your default web browser.
# --https: Enables HTTPS with a self-signed certificate for local development.
# --cors: Enables Cross-Origin Resource Sharing.
angular-http-server -p 8080 --open --https --cors

# If your 'index.html' is not directly in the current directory,
# or you need to serve from a sub-path, use --path:
# angular-http-server --path my-app-build-folder -p 4200

view raw JSON →