lagon
lagon copied to clipboard
Way to call commands programmatically?
Is your feature request related to a problem? Please describe. I’d like to build some workers into an app of my own written in JS, is there a way to import Lagon and call these functions for eg. from a job queue?
Describe the solution you'd like Being able to do something like this
import { deploy } from “lagon”
const myCode = “….”
const myFunction = deploy(myCode)
const result = await fetch(myFunction.endpoint)
A problem I may see is my app and lagon might not share the same process? Also that the cli is written in rust?
You can't import Lagon from Node, as both the CLI and Runtime are written in Rust and we don't yet provide a binding.
The easiest option might be to execute the CLI (lagon deploy <file>
), but not that I wouldn't recommend using Lagon for any applications right now. It's still in heavy development, and features, documentation, and performances are missing.
What would providing the bindings look like do you think? I hear a lot of talk of napi vs wasm - eg from which I’m deducing n-api would be best suited here?
I think the best option would be to use napi-rs. It's already used by big projects and works for every latest Node.js version.