Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ wash new https://github.com/wasmCloud/typescript.git --name my-project --subfold
| [http-hello-world-hono](./templates/http-hello-world-hono/) | Minimal HTTP server component using Hono |
| [http-hello-world-fetch](./templates/http-hello-world-fetch/) | Minimal HTTP server component using the `fetch()` API |
| [http-client](./templates/http-client/) | Component that makes outgoing HTTP requests |
| [http-service-hono](./templates/http-service-hono/) | HTTP service component powered by Hono |
| [http-blobstore-service-hono](./templates/http-blobstore-service-hono/) | HTTP service component powered by Hono, backed by `wasi:blobstore` |
| [http-kv-service-hono](./templates/http-kv-service-hono/) | HTTP service component powered by Hono, backed by `wasi:keyvalue` |
| [http-handler-hono](./templates/http-handler-hono/) | HTTP handler component powered by Hono |
| [http-blobstore-handler-hono](./templates/http-blobstore-handler-hono/) | HTTP handler component powered by Hono, backed by `wasi:blobstore` |
| [http-kv-handler-hono](./templates/http-kv-handler-hono/) | HTTP handler component powered by Hono, backed by `wasi:keyvalue` |
| [service-tcp-echo](./templates/service-tcp-echo/) | Service + component template demonstrating `wasi:sockets` TCP |

See the [templates README](./templates/README.md) for more details.
Expand Down
10 changes: 5 additions & 5 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Project templates for building wasmCloud components with TypeScript.
| [http-hello-world-hono](./http-hello-world-hono/) | Minimal HTTP server component using Hono |
| [http-hello-world-fetch](./http-hello-world-fetch/) | Minimal HTTP server component using the `fetch()` API |
| [http-client](./http-client/) | Component that makes outgoing HTTP requests |
| [http-service-hono](./http-service-hono/) | HTTP service component powered by Hono |
| [http-blobstore-service-hono](./http-blobstore-service-hono/) | HTTP service component powered by Hono, backed by `wasi:blobstore`|
| [http-kv-service-hono](./http-kv-service-hono/) | HTTP service component powered by Hono, backed by `wasi:keyvalue` |
| [http-handler-hono](./http-handler-hono/) | HTTP handler component powered by Hono |
| [http-blobstore-handler-hono](./http-blobstore-handler-hono/) | HTTP handler component powered by Hono, backed by `wasi:blobstore`|
| [http-kv-handler-hono](./http-kv-handler-hono/) | HTTP handler component powered by Hono, backed by `wasi:keyvalue` |
| [service-tcp-echo](./service-tcp-echo/) | Service + component template demonstrating `wasi:sockets` TCP |

## Template Structure
Expand Down Expand Up @@ -60,8 +60,8 @@ For example:
package wasmcloud:templates@0.1.0;

// language: typescript
// use-case: http-service-hono
world typescript-http-service-hono {
// use-case: http-handler-hono
world typescript-http-handler-hono {
export wasi:http/incoming-handler@0.2.3;
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ new:

build:
command: npm run build
component_path: dist/http_blobstore_service_hono.wasm
component_path: dist/http_blobstore_handler_hono.wasm

dev:
wasi_blobstore_path: tmp/blobstore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HTTP + Blobstore Service with Hono in TypeScript
# HTTP + Blobstore Handler with Hono in TypeScript

This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP service using the [Hono][hono] web framework, with persistent storage backed by [`wasi:blobstore`][wasi-blobstore].
This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP handler using the [Hono][hono] web framework, with persistent storage backed by [`wasi:blobstore`][wasi-blobstore].

[wasi-blobstore]: https://github.com/WebAssembly/wasi-blobstore

Expand Down Expand Up @@ -30,11 +30,11 @@ This project also uses [`rolldown`][rolldown] to transpile Typescript and bundle
Use `wash new` to scaffold a new wasmCloud component project:

```shell
wash new https://github.com/wasmCloud/typescript.git --name http-blobstore-service-hono --subfolder templates/http-blobstore-service-hono --git-ref v2
wash new https://github.com/wasmCloud/typescript.git --name http-blobstore-handler-hono --subfolder templates/http-blobstore-handler-hono --git-ref v2
```

```shell
cd http-blobstore-service-hono
cd http-blobstore-handler-hono
```

To build this project and run in a hot-reloading development loop, run `npm run dev` from this directory:
Expand Down Expand Up @@ -63,7 +63,7 @@ npm run dev

### Middleware

The service demonstrates several Hono middleware patterns:
The handler demonstrates several Hono middleware patterns:

- **Request logging** - All requests are logged with timing information
- **Response timing** - `X-Response-Time` header added to all responses
Expand Down Expand Up @@ -110,7 +110,7 @@ curl -X POST http://localhost:8000/api/echo \

### Error Handling

The service includes comprehensive error handling:
The handler includes comprehensive error handling:

- **HTTPException** for structured error responses
- **Custom 404 handler** with helpful error messages
Expand All @@ -127,7 +127,7 @@ npm run build
This component uses the following [WIT interfaces](https://component-model.bytecodealliance.org/design/wit.html):

```wit
world typescript-http-blobstore-service-hono {
world typescript-http-blobstore-handler-hono {
import wasi:blobstore/blobstore@0.2.0-draft;

export wasi:http/incoming-handler@0.2.6;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "http-blobstore-service-hono",
"name": "http-blobstore-handler-hono",
"version": "0.1.0",
"description": "A WebAssembly component HTTP service powered by Hono using the wasi:http and wasi:blobstore WIT interfaces",
"private": true,
Expand All @@ -10,9 +10,9 @@
"generate:types": "rimraf generated/types && jco guest-types wit/ -o generated/types",
"setup:wit": "npm run fetch:wit && npm run generate:types",
"build:ts": "rolldown -c rolldown.config.mjs",
"build:component": "jco componentize -w wit -o dist/http_blobstore_service_hono.wasm dist/component.js",
"build:component": "jco componentize -w wit -o dist/http_blobstore_handler_hono.wasm dist/component.js",
"build": "npm run setup:wit && npm run build:ts && npm run build:component",
"serve": "jco serve dist/http_blobstore_service_hono.wasm",
"serve": "jco serve dist/http_blobstore_handler_hono.wasm",
"dev": "nodemon"
},
"keywords": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ app.use('*', async (c, next) => {
// API information
app.get('/', (c) => {
return c.json({
name: 'Hono HTTP Blobstore Service',
name: 'Hono HTTP Blobstore Handler',
version: '1.0.0',
description: 'A comprehensive HTTP service built with Hono on wasmCloud, backed by wasi:blobstore',
description: 'A comprehensive HTTP handler built with Hono on wasmCloud, backed by wasi:blobstore',
endpoints: {
'/': 'API information (this page)',
'/health': 'Health check endpoint',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wasmcloud:templates@0.1.0;

world typescript-http-blobstore-service-hono {
world typescript-http-blobstore-handler-hono {
import wasi:blobstore/blobstore@0.2.0-draft;

export wasi:http/incoming-handler@0.2.6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ new:

build:
command: npm run build
component_path: dist/http_filesystem_service_hono.wasm
component_path: dist/http_filesystem_handler_hono.wasm

dev:
volumes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Filesystem Service with Hono in TypeScript
# HTTP Filesystem Handler with Hono in TypeScript

A WebAssembly component built with [TypeScript][ts] that serves files from a mounted directory using [Hono][hono], [jco-std][jco-std], and [`wasi:filesystem`][wasi-filesystem].

Expand Down Expand Up @@ -30,11 +30,11 @@ This project also uses [`rolldown`][rolldown] to transpile Typescript and bundle
Use `wash new` to scaffold a new wasmCloud component project:

```shell
wash new https://github.com/wasmCloud/typescript.git --name http-filesystem-service-hono --subfolder templates/http-filesystem-service-hono
wash new https://github.com/wasmCloud/typescript.git --name http-filesystem-handler-hono --subfolder templates/http-filesystem-handler-hono
```

```shell
cd http-filesystem-service-hono
cd http-filesystem-handler-hono
```

Create a `data/` directory with some files to serve:
Expand Down Expand Up @@ -114,7 +114,7 @@ npm run build
This component uses the following [WIT interfaces](https://component-model.bytecodealliance.org/design/wit.html):

```wit
world typescript-http-filesystem-service-hono {
world typescript-http-filesystem-handler-hono {
import wasi:filesystem/types@0.2.2;
import wasi:filesystem/preopens@0.2.2;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "http-filesystem-service-hono",
"name": "http-filesystem-handler-hono",
"version": "0.1.0",
"description": "A WebAssembly component HTTP service using Hono with wasi:filesystem for reading and writing files",
"private": true,
Expand All @@ -10,9 +10,9 @@
"generate:types": "rimraf generated/types && jco guest-types wit/ -o generated/types",
"setup:wit": "npm run fetch:wit && npm run generate:types",
"build:ts": "rolldown -c rolldown.config.mjs",
"build:component": "jco componentize -w wit -o dist/http_filesystem_service_hono.wasm dist/component.js",
"build:component": "jco componentize -w wit -o dist/http_filesystem_handler_hono.wasm dist/component.js",
"build": "npm run setup:wit && npm run build:ts && npm run build:component",
"serve": "jco serve dist/http_filesystem_service_hono.wasm",
"serve": "jco serve dist/http_filesystem_handler_hono.wasm",
"dev": "nodemon"
},
"keywords": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wasmcloud:templates@0.1.0;

world typescript-http-filesystem-service-hono {
world typescript-http-filesystem-handler-hono {
import wasi:filesystem/types@0.2.2;
import wasi:filesystem/preopens@0.2.2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ new:

build:
command: npm run build
component_path: dist/http_service_hono.wasm
component_path: dist/http_handler_hono.wasm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HTTP Service with Hono in TypeScript
# HTTP Handler with Hono in TypeScript

This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP service using the [Hono][hono] web framework, making requests against a simulated database.
This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP handler using the [Hono][hono] web framework, making requests against a simulated database.

To bridge Hono's API and WebAssembly primitives, this component makes use of the [`@bytecodealliance/jco-std`][jco-std] adapter (which translates Hono API to [`wasi:http/incoming-handler`][wasi-http] primitives).

Expand Down Expand Up @@ -28,11 +28,11 @@ This project also uses [`rolldown`][rolldown] to transpile Typescript and bundle
Use `wash new` to scaffold a new wasmCloud component project:

```shell
wash new https://github.com/wasmCloud/typescript.git --name http-service-hono --subfolder templates/http-service-hono
wash new https://github.com/wasmCloud/typescript.git --name http-handler-hono --subfolder templates/http-handler-hono
```

```shell
cd http-service-hono
cd http-handler-hono
```

To build this project and run in a hot-reloading development loop, run `npm run dev` from this directory:
Expand Down Expand Up @@ -61,7 +61,7 @@ npm run dev

### Middleware

The service demonstrates several Hono middleware patterns:
The handler demonstrates several Hono middleware patterns:

- **CORS** - Cross-origin resource sharing enabled for all origins
- **Request logging** - All requests are logged with timing information
Expand Down Expand Up @@ -109,7 +109,7 @@ curl -X POST http://localhost:8000/api/echo \

### Error Handling

The service includes comprehensive error handling:
The handler includes comprehensive error handling:

- **HTTPException** for structured error responses
- **Custom 404 handler** with helpful error messages
Expand All @@ -126,7 +126,7 @@ npm run build
This component exports the following [WIT interfaces](https://component-model.bytecodealliance.org/design/wit.html):

```wit
world typescript-http-service-hono {
world typescript-http-handler-hono {
export wasi:http/incoming-handler@0.2.3;
}
```
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "http-service-hono",
"name": "http-handler-hono",
"version": "0.1.0",
"description": "A WebAssembly component HTTP service powered by Hono using the wasi:http WIT interface",
"private": true,
Expand All @@ -10,9 +10,9 @@
"generate:types": "rimraf generated/types && jco guest-types wit/ -o generated/types",
"setup:wit": "npm run fetch:wit && npm run generate:types",
"build:ts": "rolldown -c rolldown.config.mjs",
"build:component": "jco componentize -w wit -o dist/http_service_hono.wasm dist/component.js",
"build:component": "jco componentize -w wit -o dist/http_handler_hono.wasm dist/component.js",
"build": "npm run setup:wit && npm run build:ts && npm run build:component",
"serve": "jco serve dist/http_service_hono.wasm",
"serve": "jco serve dist/http_handler_hono.wasm",
"dev": "nodemon"
},
"keywords": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ app.use('*', async (c, next) => {
// API information
app.get('/', (c) => {
return c.json({
name: 'Hono HTTP Service',
name: 'Hono HTTP Handler',
version: '1.0.0',
description: 'A comprehensive HTTP service built with Hono on wasmCloud',
description: 'A comprehensive HTTP handler built with Hono on wasmCloud',
endpoints: {
'/': 'API information (this page)',
'/health': 'Health check endpoint',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package wasmcloud:templates@0.1.0;

world typescript-http-service-hono {
world typescript-http-handler-hono {
export wasi:http/incoming-handler@0.2.6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ new:

build:
command: npm run build
component_path: dist/http_kv_service_hono.wasm
component_path: dist/http_kv_handler_hono.wasm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HTTP + Key-Value Service with Hono in TypeScript
# HTTP + Key-Value Handler with Hono in TypeScript

This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP service using the [Hono][hono] web framework, with persistent storage backed by [`wasi:keyvalue`][wasi-kv].
This project template is a WebAssembly component built with [TypeScript][ts] that demonstrates a comprehensive HTTP handler using the [Hono][hono] web framework, with persistent storage backed by [`wasi:keyvalue`][wasi-kv].

[wasi-kv]: https://github.com/WebAssembly/wasi-keyvalue

Expand Down Expand Up @@ -30,11 +30,11 @@ This project also uses [`rolldown`][rolldown] to transpile Typescript and bundle
Use `wash new` to scaffold a new wasmCloud component project:

```shell
wash new https://github.com/wasmCloud/typescript.git --name http-kv-service-hono --subfolder templates/http-kv-service-hono --git-ref v2
wash new https://github.com/wasmCloud/typescript.git --name http-kv-handler-hono --subfolder templates/http-kv-handler-hono --git-ref v2
```

```shell
cd http-kv-service-hono
cd http-kv-handler-hono
```

To build this project and run in a hot-reloading development loop, run `npm run dev` from this directory:
Expand Down Expand Up @@ -63,7 +63,7 @@ npm run dev

### Middleware

The service demonstrates several Hono middleware patterns:
The handler demonstrates several Hono middleware patterns:

- **Request logging** - All requests are logged with timing information
- **Response timing** - `X-Response-Time` header added to all responses
Expand Down Expand Up @@ -110,7 +110,7 @@ curl -X POST http://localhost:8000/api/echo \

### Error Handling

The service includes comprehensive error handling:
The handler includes comprehensive error handling:

- **HTTPException** for structured error responses
- **Custom 404 handler** with helpful error messages
Expand All @@ -127,7 +127,7 @@ npm run build
This component uses the following [WIT interfaces](https://component-model.bytecodealliance.org/design/wit.html):

```wit
world typescript-http-kv-service-hono {
world typescript-http-kv-handler-hono {
import wasi:keyvalue/store@0.2.0-draft;
import wasi:keyvalue/atomics@0.2.0-draft;

Expand Down
Loading