Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ncitron/oframl

A framework for building Farcaster Frames in OCaml
https://github.com/ncitron/oframl

Last synced: 22 days ago
JSON representation

A framework for building Farcaster Frames in OCaml

Awesome Lists containing this project

README

        

## Oframl
Oframl is a simple framework for building Farcaster Frames in OCaml.

## Usage

```OCaml
open Oframl

let image_handler (data : string) =
let str = if String.equal data "initial" then
"Click to fetch FID"
else
[%string "FID: %{data}"]
in
[%string
{|


%{str}

|}]
;;

let frame_handler (): frame =
{ title = "FID Check"
; image_extra_data = "initial"
; post_extra_data = ""
; buttons = [ { content = "Check FID" } ]
}
;;

let post_handler (act : action) (_data : string) : frame =
{ title = "FID Check"
; image_extra_data = string_of_int act.fid
; post_extra_data = ""
; buttons = []
}
;;

let base_url = "https://df78-72-69-118-50.ngrok-free.app" in
let start = Server.start base_url frame_handler post_handler image_handler in
Lwt_main.run start
```

## Examples
To view more examples see [examples](./examples)