README: Add miniflare
This commit is contained in:
parent
10a28cdabc
commit
5718c72b95
1 changed files with 8 additions and 2 deletions
10
README.md
10
README.md
|
|
@ -6,11 +6,17 @@ I run this code in production on [erisa.link](https://erisa.link/example), thoug
|
||||||
|
|
||||||
It was made for my personal use but is available publicly in the hopes that it may be useful to someone somewhere.
|
It was made for my personal use but is available publicly in the hopes that it may be useful to someone somewhere.
|
||||||
|
|
||||||
## Usage
|
## Deploy
|
||||||
|
|
||||||
To deploy to your Cloudflare Workers account, edit the relevant entries in `wrangler.toml`, add a secret with `wrangler secret put WORKERLINKS_SECRET` and use `wrangler publish`.
|
To deploy to your Cloudflare Workers account, edit the relevant entries in `wrangler.toml`, add a secret with `wrangler secret put WORKERLINKS_SECRET` and use `wrangler publish`.
|
||||||
For debugging, you can use `wrangler preview`, though note you will need to login and configure a preview KV namespace in `wrangler.toml`.
|
For debugging, you either can use `wrangler preview`, though note you will need to login and configure a preview KV namespace in `wrangler.toml` - or use Miniflare (See below).
|
||||||
|
|
||||||
|
## Running locally
|
||||||
|
If you want to run this locally (Not on Cloudflare), you can use [miniflare](https://github.com/mrbbot/miniflare):
|
||||||
|
- `npm install` or `npm install -g miniflare`
|
||||||
|
- `miniflare index.js -k kv -b WORKERLINKS_SECRET=putyoursecrethere`
|
||||||
|
|
||||||
|
## Usage
|
||||||
Once deployed, interacting with the API should be rather simple. It's based on headers, specifically with the `Authorization` and `URL` headers.
|
Once deployed, interacting with the API should be rather simple. It's based on headers, specifically with the `Authorization` and `URL` headers.
|
||||||
|
|
||||||
To create a short URL with a random URL, send a `POST` to `/` with `Authorization` and `URL` headers:
|
To create a short URL with a random URL, send a `POST` to `/` with `Authorization` and `URL` headers:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue