Skip to content

Commit

Permalink
docs: initial documentation (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkingland authored Sep 26, 2024
1 parent 1c3c7b3 commit 4078dcd
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
29 changes: 28 additions & 1 deletion cmd/fhttp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
# Function HTTP Test Command

fhttp is a command which illustrates how the func-python library
fhttp is a command which illustrates how the func-python library middleware
wraps a function and exposes it as a service. Useful for development.

This is an example usage of the Functions HTTP middleware.

To see the actual middleware which is used when building a Python Function,
see the [Functions Python Scaffolding](https://github.com/knative/func/tree/main/templates/python/http)

## Running

Create a local virtual environment if it does not already exist:
```bash
python3 -m venv venv
```
Activate the virtual environment:
```bash
source ./venv/bin/activate
```
Ensure the requirements are installed:
```bash
pip install -r requirements.txt
```
Run the application:
```bash
python3 ./main.py
```
use `^C` to stop the application

To Deactivate the virtual environment:
```bash
deactivate
22 changes: 22 additions & 0 deletions http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Functions Python Middleware

An ASGI Application which will serve a Function. The ASGI application
is the middleware.

The middleware implements lifecycle events such as "start" and "stop", health
checks for readiness and liveness, and a handler for HTTP requests.

The function is expected to implement "handle", and the middleware will
raise an error if the function does not implement this method. Start and stop
are optional. Readiness and liveness are also optional, with the middleware
providing default implementations.

Signals are handled by the ASGI server implementation hypercorn and initiate
shutdown of the service.

## Usage

To see a usage example, refer to cmd/fhttp.



0 comments on commit 4078dcd

Please sign in to comment.