An application server for isolated JavaScript
npm install jamJam is an application server for isolated JavaScript. It runs JavaScript (and TypeScript) per request with isolated execution contexts, inspired by the PHP-FPM model.
``sh`
npm install -g jam
jam --help
Create a scripts/app.ts file:
`ts`
export default {
fetch(request: Request): Response {
return new Response("Hello from Jam");
}
};
Start Jam, pointing it at the scripts folder:
`sh`
jam ./scripts
Now make a request. Jam maps /app to app.ts.
`sh`
curl http://localhost:3000/app
Edit the file and make the same request again. The next request runs the updated script immediately, with no rebuilds or restarts.
To learn more, see the documentation.
The jam package uses platform-specific optional dependencies. During install, npm picks the matching package for your OS/CPU target:
- jam-darwin-arm64
- jam-darwin-x64
- jam-linux-x64
- jam-linux-arm64
Current support is macOS (darwin) and Linux glibc builds. Linux musl and Windows targets are not published yet.
- JAM_LIBC=glibc|musl: override Linux libc detection.JAM_BINARY_PATH=
-
Install dependencies with optional dependencies enabled so the matching platform package is available.