Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 12, 2023
1 parent 56173e5 commit 4169f50
Showing 1 changed file with 43 additions and 16 deletions.
59 changes: 43 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
# πŸ‘‚ listhen

An elegant HTTP listener.

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
[![JSDocs][jsdocs-src]][jsdocs-href]

Elegant HTTP listener!

[πŸ‘‰ Online Playground](https://stackblitz.com/github/unjs/listhen/tree/main/playground?startScript=dev)

## Features

- Built-in CLI To run your applications with watch mode and typescript support (with [unjs/jiti](https://github.com/unjs/jiti)) and serve static files
- Promisified interface for listening and closing server
- Work with express/connect or plain http handle function
- Support HTTP and HTTPS
- Assign a port or fallback to human friendly alternative (with [unjs/get-port-please](https://github.com/unjs/get-port-please))
- Generate listening URL and show on console
- Copy URL to clipboard (dev only by default)
- Open URL in browser (opt-in)
- Generate self-signed certificate
- Detect test and production environments
- Close on exit signal
- Gracefully shutdown server with [http-shutdown](https://github.com/thedillonb/http-shutdown)
βœ… Dev Server with HMR, Static and Typescript Support (with [unjs/jiti](https://github.com/unjs/jiti))

βœ… Works with Node.js, Express, Connect and [unjs/h3](https://github.com/unjs/h3) out of the box

βœ… HTTPS support with self-signed certificates

βœ… Assign a port or fallback to human friendly fallback (with [unjs/get-port-please](https://github.com/unjs/get-port-please))

βœ… Copy URL to Clipboard

βœ… Open URL in Browser

βœ… Detect test and production environments to auto adjust behavior

βœ… Close on exit signal

βœ… Gracefully shutdown server with [http-shutdown](https://github.com/thedillonb/http-shutdown)

βœ… Show QR Code of Public URL (with [unjs/uqr](https://github.com/unjs/uqr))

## Quick Usage (CLI)

Expand All @@ -35,7 +44,7 @@ export default (req, res) => {
};
```

Using [unjs/h3](https://github.com/unjs/h3):
or using [unjs/h3](https://github.com/unjs/h3):

```ts
import { createApp, eventHandler } from "h3";
Expand All @@ -45,7 +54,7 @@ export const app = createApp();
app.use("/", () => "Hello world!");
```

Use npx to invoke `listhen` command:
or use npx to invoke `listhen` command:

```sh
npx listhen -w ./index.ts
Expand Down Expand Up @@ -160,6 +169,24 @@ Detect if running in a test environment to disable some features.
Automatically close when an exit signal is received on process.
### `publicURL`
- Default: (the first public URL listening)
The public URL to show in CLI output
### `qr`
- Default: `true`
Print QR Code for public address.
### `public`
- Default: `false` for development or when `hostname` is `localhost` and `true` for production
When enabled, listhen tries to listen to all network interfaces. You can also enable this option using `--host` CLI flag.
## License
MIT. Made with πŸ’–
Expand Down

0 comments on commit 4169f50

Please sign in to comment.