spekulatius / faasd-franc

faasd function for franc lib

Home Page:https://releasecandidate.dev/posts/2021/discovery-faasd-and-openfaas/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

faasd function for Franc

This is part of my personal exploring and probably not production ready. Use at own risk!

Preface

faasd has been really interesting to explore and work with. It's a low-footprint no/low-maintenance Function as a Service toolkit. Broadly speaking, faasd's goal is to simplify the required setup and run functions easier.

I wanted to build a super simple api endpoint to familiarize myself more with the concepts and learn. I picked the Franc npm package. Franc is a npm lib which allows you to detect the language of a given piece of text.

The faasd function for franc is the result. It should work, but no guarantees.

Building Your Own Version

  1. You can easily build your own version and host it on your faasd instance:

    git clone git@github.com:spekulatius/faasd-franc.git && cd faasd-franc
  2. Create the secret:

    echo $(head -c 16 /dev/urandom | shasum | cut -d "-" -f1) > token.txt
  3. Store it on the server:

    faas-cli secret create franc-token --from-file token.txt --gateway http://yourfaasd.somewhere.com:8080
  4. Deploy as usual:

    faas-cli up --gateway http://yourfaasd.somewhere.com:8080

About

faasd function for franc lib

https://releasecandidate.dev/posts/2021/discovery-faasd-and-openfaas/


Languages

Language:JavaScript 100.0%