Skip to content
/ openfaas_deno_func Public template

An example OpenFaaS function using the deno-http template

Notifications You must be signed in to change notification settings

gjolund/openfaas_deno_func

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An example OpenFaaS function using the deno-http template

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published