Skip to content

Commit

Permalink
chore: update usage to include h3
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 2, 2023
1 parent 3622418 commit ede3999
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ An elegant HTTP listener.

## Features

- Built-in CLI To run your applications with watch mode and typescript support (with [unjs/jiti](https://github.com/unjs/jiti))
- 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
Expand All @@ -27,18 +27,28 @@ An elegant HTTP listener.

You can run your applications in localhost with typescript support and watch mode using `listhen` CLI:

Create `app.ts`:
Create `index.ts`:

```ts
export default (req, res) => {
res.end("Hello World!");
};
```

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

```ts
import { createApp, eventHandler } from "h3";

export const app = createApp();

app.use("/", () => "Hello world!");
```

Use npx to invoke `listhen` command:

```sh
npx listhen -w ./app.ts
npx listhen -w ./index.ts
```

## Usage (API)
Expand Down

0 comments on commit ede3999

Please sign in to comment.