Skip to content

Commit

Permalink
Merge pull request #13 from sor4chi/feat/add-docs
Browse files Browse the repository at this point in the history
docs: add usage description
  • Loading branch information
sor4chi authored Sep 27, 2023
2 parents 7c92bff + c65bf24 commit cf42987
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,36 @@ Hono DO is a wrapper of [Cloudflare Workers](https://workers.cloudflare.com/) '
```bash
$ npm install hono-do
```

## Usage

```typescript
export const Counter = generateHonoObject("/counter", async (app, state) => {
const { storage } = state;
let value = (await storage.get<number>("value")) ?? 0;

app.post("/increment", (c) => {
storage.put("value", value++);
return c.text(value.toString());
});

app.post("/decrement", (c) => {
storage.put("value", value--);
return c.text(value.toString());
});

app.get("/", (c) => {
return c.text(value.toString());
});
});
```

You want to find more? Check out the [examples](./examples)!

## License

[MIT](./LICENSE)

## Contributing

This project is open for contributions. Feel free to open an issue or a pull request!

0 comments on commit cf42987

Please sign in to comment.