This is a simple wrapper around the Open Food Facts site's search engine. I wrote it as a simple Cloudflare Worker POC and because someone thought it would be a good idea to server-side render HTML and send valid JSON as an inline HTML JS script variable instead of simply sending the JSON straight away and letting the client render their stuff. It uses one of the uglier webscraping hacks I've written so far, so please don't think of it as stable or anyhow production ready.
Tools you'l need:
rustup
withwasm32-unknown-unknown
toolchain installednode
,npm
oryarn
andwranger
CLI tool installed - you can read more about this here
cp example.wrangler.toml wrangler.toml
wrangler kv:namespace create "OPENFOODS_CACHE" # for a preview namespace add `--preview`
then setup the kv_namespaces
TOML key as specified in the wrangler
command output
wrangler dev
cargo build --lib --release --target wasm32-unknown-unknown
wrangler deploy