@stremio-addon/node-express
This package is part of Stremio-Community/stremio-addon-sdk.
Node.js + Express runtime adapter for the Community Stremio Addon SDK.
Features
- 🚀 Express integration - Seamless integration with Express.js
- 🎯 Type-safe - Full TypeScript support
- 🔧 Flexible - Works with existing Express apps
Installation
pnpm add @stremio-addon/node-express express
If using TypeScript:
pnpm add -D @types/express
Usage
import express from "express";
import { getRouter } from "@stremio-addon/node-express";
import { AddonBuilder } from "@stremio-addon/sdk";
const builder = new AddonBuilder({
id: "com.example.myaddon",
version: "1.0.0",
name: "My Addon",
description: "My cool Stremio addon",
resources: ["stream"],
types: ["movie", "series"],
catalogs: [],
});
builder.defineStreamHandler(async ({ type, id }) => {
return {
streams: [
{
url: "https://example.com/stream.mp4",
title: "Example Stream",
},
],
};
});
const addonInterface = builder.getInterface();
const app = express();
app.use(getRouter(addonInterface));
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Addon available at http://localhost:${PORT}/manifest.json`);
});
API
getRouter(addonInterface)
Creates an Express router configured to serve your addon.
Parameters:
addonInterface - The addon interface from builder.getInterface()
Returns: Express Router instance
Examples
See the hello-world example for a complete working example.
Related Packages
License
MIT