Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 2.76 KB

README.md

File metadata and controls

81 lines (53 loc) · 2.76 KB

OpenFaaS Deno HTTP function

An OpenFaaS of-watchdog function written for Deno.

Installation

faas template pull https://github.com/austinrivas/deno-http-template

Create Function

faas new <name> --lang deno-http

Testing

Deno ships with a built in test runner

deno test --allow-net

This repo also includes vscode debug configurations for local debugging.

  • Run Tests
  • Debug Current Test File
  • Debug Seleted Test Case

Linting

Deno also provides a built in code linter.

deno fmt

Deployment

faas up -f function.yml --gateway $GATEWAY_URL

Remote Debugging

This function includes an okteto.yml function to facilitate remote dev and debugging.

To launch to remote debugger you must start the debug process in oketeto.

cd function
okteto up
 ✓  Development environment activated
 ✓  Files synchronized
    Namespace: austinrivas
    Name:      deno-hello
    Forward:   8080 -> 8080
               9229 -> 9229
okteto> fwatchdog

Once the debug session is listening you can attach to it from chrome://inspect and set breakpoints as required.

When you are done debugging you should exit the okteto shell and run okteto down to restore the OpenFaaS function context.

This function is based on the OpenFaaS deno-http-template.

This template provides a thin wrapper around the Deno Http Server provided by the Deno stdlib. The wrapper implementation closely mirrors the Deno serve function.

The function handler in this example is as simple as possible. It merely consumes the Deno ServerRequest and responds with a "Deno says Hello OpenFaaS!" message.

Extras

This repo also contains an Okteto Remote Development Configuration for use on the Okteto Platform.

A Test and Enforce Deno Format github action is included that will trigger on pull request. This action runs the deno tests and throws an error if deno fmt returns changes.