# http-server-legacy

> A simple zero-configuration command-line http server - do not use me

Latest version **0.11.1** (published 2019-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install http-server-legacy
pnpm add http-server-legacy
yarn add http-server-legacy
bun add http-server-legacy
```

Provides the commands `hs`, `http-server`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: no vulnerabilities; popular repo.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: insecure dependencies; abandoned.

## Facts

| | |
|---|---|
| Version | 0.11.1 |
| Published | 2019-05-02 |
| First published | 2019-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14237 |
| Maintainers | nolman |
| Keywords | cli, command |

## Links

- npm: https://www.npmjs.com/package/http-server-legacy
- Repository: https://github.com/indexzero/http-server
- Homepage: https://github.com/indexzero/http-server#readme
- Issues: https://github.com/nodeapps/http-server/issues
- npm.io page: https://npm.io/package/http-server-legacy

## Dependencies (10)

- [union](https://npm.io/package/union.md) ~0.5.0
- [colors](https://npm.io/package/colors.md) ^1.3.3
- [corser](https://npm.io/package/corser.md) ^2.0.1
- [opener](https://npm.io/package/opener.md) ^1.5.1
- [ecstatic](https://npm.io/package/ecstatic.md) git+https://github.com/Blackbaud-ShaydeNofziger/node-ecstatic.git#d47ffccf932962295a1feb74334d3ab8d0b17a66
- [optimist](https://npm.io/package/optimist.md) ~0.6.1
- [basic-auth](https://npm.io/package/basic-auth.md) ^1.0.3
- [http-proxy](https://npm.io/package/http-proxy.md) ^1.17.0
- [portfinder](https://npm.io/package/portfinder.md) ^1.0.20
- [secure-compare](https://npm.io/package/secure-compare.md) 3.0.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.11.1 (latest) — 2019-05-02

## README

[![build status](https://img.shields.io/travis/indexzero/http-server.svg?style=flat-square)](https://travis-ci.org/indexzero/http-server)
[![dependencies status](https://img.shields.io/david/indexzero/http-server.svg?style=flat-square)](https://david-dm.org/indexzero/http-server)
[![npm](https://img.shields.io/npm/v/http-server.svg?style=flat-square)](https://www.npmjs.com/package/http-server)
[![license](https://img.shields.io/github/license/indexzero/http-server.svg?style=flat-square)](https://github.com/indexzero/http-server)

# http-server: a command-line http server

`http-server` is a simple, zero-configuration command-line http server.  It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.

![](https://github.com/nodeapps/http-server/raw/master/screenshots/public.png)

# Installing globally:

Installation via `npm`:

     npm install http-server -g

This will install `http-server` globally so that it may be run from the command line.

## Running on-demand:

Using `npx` you can run the script without installing it first:

     npx http-server [path] [options]

## Usage:

     http-server [path] [options]

`[path]` defaults to `./public` if the folder exists, and `./` otherwise.

*Now you can visit http://localhost:8080 to view your server*

**Note:** Caching is on by default. Add `-c-1` as an option to disable caching.

## Available Options:

`-p` or `--port` Port to use (defaults to 8080)

`-a` Address to use (defaults to 0.0.0.0)

`-d` Show directory listings (defaults to `true`)

`-i` Display autoIndex (defaults to `true`)

`-g` or `--gzip` When enabled (defaults to `false`) it will serve `./public/some-file.js.gz` in place of `./public/some-file.js` when a gzipped version of the file exists and the request accepts gzip encoding. If brotli is also enabled, it will try to serve brotli first.

`-b` or `--brotli` When enabled (defaults to `false`) it will serve `./public/some-file.js.br` in place of `./public/some-file.js` when a brotli compressed version of the file exists and the request accepts `br` encoding. If gzip is also enabled, it will try to serve brotli first.

`-e` or `--ext` Default file extension if none supplied (defaults to `html`)

`-s` or `--silent` Suppress log messages from output

`--cors` Enable CORS via the `Access-Control-Allow-Origin` header

`-o [path]` Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/

`-c` Set cache time (in seconds) for cache-control max-age header, e.g. `-c10` for 10 seconds (defaults to `3600`). To disable caching, use `-c-1`.

`-U` or `--utc` Use UTC time format in log messages.

`--log-ip` Enable logging of the client's IP address (default: `false`).

`-P` or `--proxy` Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

`--username` Username for basic authentication [none]

`--password` Password for basic authentication [none]

`-S` or `--ssl` Enable https.

`-C` or `--cert` Path to ssl cert file (default: `cert.pem`).

`-K` or `--key` Path to ssl key file (default: `key.pem`).

`-r` or `--robots` Provide a /robots.txt (whose content defaults to `User-agent: *\nDisallow: /`)

`-h` or `--help` Print this list and exit.

## Magic Files

- `index.html` will be served as the default file to any directory requests.
- `404.html` will be served if a file is not found. This can be used for Single-Page App (SPA) hosting to serve the entry page.

# Development

Checkout this repository locally, then:

```sh
$ npm i
$ node bin/http-server
```

*Now you can visit http://localhost:8080 to view your server*

You should see the turtle image in the screenshot above hosted at that URL. See
the `./public` folder for demo content.

---
_Source: https://npm.io/package/http-server-legacy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
