Skip to content

Commit

Permalink
Merge pull request #259 from kitsuyui/update-readme-npm
Browse files Browse the repository at this point in the history
Update readme npm
  • Loading branch information
kitsuyui authored Aug 9, 2022
2 parents 7ce6c75 + f5d7f3b commit 4e0a311
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# rendering-proxy

[![npm version](https://badge.fury.io/js/rendering-proxy.svg)](https://badge.fury.io/js/rendering-proxy)
[![codecov](https://codecov.io/gh/kitsuyui/rendering-proxy/branch/main/graph/badge.svg?token=zX1IVwqQab)](https://codecov.io/gh/kitsuyui/rendering-proxy)
[![test](https://github.com/kitsuyui/rendering-proxy/actions/workflows/test.yml/badge.svg)](https://github.com/kitsuyui/rendering-proxy/actions/workflows/test.yml)
[![Docker Pulls](https://img.shields.io/docker/pulls/kitsuyui/rendering-proxy.svg)](https://hub.docker.com/r/kitsuyui/rendering-proxy/)
Expand All @@ -15,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 @@ -43,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 4e0a311

Please sign in to comment.