docs: write instructions (#125)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent 4dd0ede · Browse files · 1 file·+30 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+30 added−18 removed
- other:+30 added−18 removed
Provenance
- Commit
9dcc24c- Tree
df0788b- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
4dd0ede
1 file changed+30 added−18 removed
modified:README.md+30 added-18 removed
379 unmodified lines380 ```381 382 ## Cloudflare Workers with Hono383 384-Using `wrangler` or `miniflare`, you can develop the application locally and publish it with few commands.384+Using [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/) or [Miniflare](https://miniflare.dev), you can develop the application locally and publish it with few commands.385 386 Let's write your first code for Cloudflare Workers with Hono.387 388-### 1. Install Wrangler388+---389 390-Install Cloudflare Command Line "[Wrangler](https://github.com/cloudflare/wrangler)".390+### Caution391 392-```sh393-$ npm i @cloudflare/wrangler -g394-```392+**Wrangler 1.x** does not support importing middleware. We recommend two ways:393 396-### 2. `npm init`394+1. Use [Wragler 2.0 Beta](https://github.com/cloudflare/wrangler2).395+2. Build without webpack 4.x. For example, you can use esbuild. See [the starter template](https://github.com/yusukebe/hono-minimal).396 397+---398+399+### 1. `npm init`400+401 Make a npm skeleton directory.402 403 ```sh404 mkdir hono-example405 cd hono-example406 npm init -y407 ```408 406-### 3. `wrangler init`409+### 2. `wrangler init`410 408-Init as a wrangler project.411+Initialize as a wrangler project.412 410-```sh411-$ wrangler init413 ```414+$ npx wrangler@beta init415+```416 414-### 4. `npm install hono`417+Answer the questions. If you want, you can answer `y`.418 419+```420+Would you like to install wrangler into your package.json? (y/n) <--- n421+Would you like to use TypeScript? (y/n) <--- n422+Would you like to create a Worker at src/index.js? (y/n) <--- n423+```424+425+### 3. `npm install hono`426+427 Install `hono` from the npm registry.428 429 ```sh430 $ npm i hono431 ```432 422-### 5. Write your app433+### 4. Write your app434 435 Only 4 lines!!436 437 ```js438+// index.js439 import { Hono } from 'hono'440 const app = new Hono()441 442 app.get('/', (c) => c.text('Hello! Hono!'))443 444 app.fire()445 ```446 435-### 6. Run447+### 5. Run448 449 Run the development server locally. Then, access `http://127.0.0.1:8787/` in your Web browser.450 451 ```sh440-$ wrangler dev452+$ npx wrangler@beta dev index.js453 ```454 443-### 7. Publish455+### 6. Publish456 457 Deploy to Cloudflare. That's all!458 459 ```sh448-$ wrangler publish460+$ npx wrangler@beta publish index.js461 ```462 463 ## Starter template464 453-You can start making your application of Cloudflare Workers with [the starter template](https://github.com/yusukebe/hono-minimal). It is a realy minimal using TypeScript, esbuild, and Miniflare.465+You can start making your application of Cloudflare Workers with [the starter template](https://github.com/yusukebe/hono-minimal). It is really minimal using TypeScript, esbuild, and Miniflare.466 467 To generate a project skelton, run this command.468 469 ```38 unmodified lines