Skip to content

Commit

Permalink
Update usage and installation
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsuyui committed Aug 9, 2022
1 parent 082f1cb commit f5d7f3b
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,50 @@ So this library provides simplicity in these cases:
- Text browsers
- Command line interface like curl wget

# Installation

published on [npm](https://www.npmjs.com/package/rendering-proxy)

```sh
$ npm install rendering-proxy
```

```sh
$ yarn add rendering-proxy
```

# Usage

## Server mode
```console
$ rendering-proxy --help
rendering-proxy <command>

Commands:
rendering-proxy cli [url] CLi mode
rendering-proxy server Server mode

Options:
--version Show version number [boolean]
--help Show help [boolean]
```

## CLI mode

```console
$ docker run -d -p 8080:8080 kitsuyui/rendering-proxy
$ curl localhost:8080/https://example.com/
$ yarn run rendering-proxy cli https://example.com/
<html><head>
...
</body></html>
```

## CLI mode
## Server mode

```console
$ yarn run rendering-proxy server --port=8080
```

```console
$ docker run --rm kitsuyui/rendering-proxy cli https://example.com/
$ curl http://localhost:8080/https://example.com/
<html><head>
...
</body></html>
Expand All @@ -44,7 +72,7 @@ $ docker run --rm kitsuyui/rendering-proxy cli https://example.com/
When `-e`, `--evaluate` is specified, JavaScript code is evaluated before getting DOM.

```console
$ yarn ts-node src/main.ts cli https://example.com/ -e 'document.title = "updated"' -e 'document.title += " twice"'
$ yarn run rendering-proxy cli https://example.com/ -e 'document.title = "updated"' -e 'document.title += " twice"'
<!DOCTYPE html><html><head>
<title>updated twice</title>
...
Expand Down

0 comments on commit f5d7f3b

Please sign in to comment.