diff --git a/README.md b/README.md index f428ef8..0b7ff9a 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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"; @@ -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 @@ -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 💖