Skip to content

Commit

Permalink
Add README's to the templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrossley3 committed Jun 9, 2021
1 parent 8f1e3dd commit 44ec063
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkged.go

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions templates/rust/events/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Rust HTTP Function

Welcome to your new Rust function project! The boilerplate
[actix](https://actix.rs/) app can be found in
[`src/main.rs`](./src/main.rs). The `handle` function will respond to
POST requests containing a `CloudEvent`.

The app will expose three endpoints:

* `/` Triggers the `handle` function for a POST method
* `/health/readiness` The endpoint for a readiness health check
* `/health/liveness` The endpoint for a liveness health check

You may use any of the available [actix
features](https://actix.rs/docs/) to fulfill the requests at those
endpoints.

## Development

This is a fully self-contained application, so you can develop it as
you would any other Rust application, e.g.

```shell script
cargo build
cargo test
cargo run
```

Once running, the function is available at <http://localhost:8080> and
the health checks are at <http://localhost:8080/health/readiness> and
<http://localhost:8080/health/liveness>. To POST an event to the
function, a utility such as `curl` may be used:

```console
curl -X POST -d '{"name": "bootsy"}' \
-H'Content-type: application/json' \
-H'ce-specversion: 1.0' \
-H'ce-id: 1' \
-H'ce-source: http://cloudevents.io' \
-H'ce-type: dev.knative.example' \
http://localhost:8080
```

## Deployment

Use `func` to containerize your application, publish it to a registry
and deploy it as a Knative Service in your Kubernetes cluster:

```shell script
func deploy --registry=docker.io/<YOUR_ACCOUNT>
```

You can omit the `--registry` option by setting the `FUNC_REGISTRY`
environment variable. And if you forget, you'll be prompted.

Have fun!
52 changes: 52 additions & 0 deletions templates/rust/http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Rust HTTP Function

Welcome to your new Rust function project! The boilerplate
[actix](https://actix.rs/) app can be found in
[`src/main.rs`](./src/main.rs). The `index` function will respond to
both GET and POST requests as configured in the `main` function.

The app will expose three endpoints:

* `/` Triggers the `index` function, for either GET or POST methods
* `/health/readiness` The endpoint for a readiness health check
* `/health/liveness` The endpoint for a liveness health check

You may use any of the available [actix
features](https://actix.rs/docs/) to fulfill the requests at those
endpoints.

## Development

This is a fully self-contained application, so you can develop it as
you would any other Rust application, e.g.

```shell script
cargo build
cargo test
cargo run
```

Once running, the function is available at <http://localhost:8080> and
the health checks are at <http://localhost:8080/health/readiness> and
<http://localhost:8080/health/liveness>. To POST data to the function,
a utility such as `curl` may be used:

```console
curl -X POST -d '{"hello": "world"}' \
-H'Content-type: application/json' \
http://localhost:8080
```

## Deployment

Use `func` to containerize your application, publish it to a registry
and deploy it as a Knative Service in your Kubernetes cluster:

```shell script
func deploy --registry=docker.io/<YOUR_ACCOUNT>
```

You can omit the `--registry` option by setting the `FUNC_REGISTRY`
environment variable. And if you forget, you'll be prompted.

Have fun!

0 comments on commit 44ec063

Please sign in to comment.