NeonElectrify Node.js with the power of Rust!
// JavaScript
const URL = "https://jsonplaceholder.typicode.com/todos";
async function todos() {
return (await fetch(URL)).json();
}
module.exports = todos;
// Neon
const URL: &str = "https://jsonplaceholder.typicode.com/todos";
#[neon::export(json)]
async fn todos() -> Result<serde_json::Value, Error> {
Ok(reqwest::get(URL).await?.json().await?)
}
Simple tooling.
No build scripts. No finicky system dependencies. Just Node and Rust.
Guaranteed safety.
If a Neon module compiles, it is guaranteed by the Rust compiler to be memory-safe.
Easy parallelism.
Safely run multiple threads—without data races.