Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By drashlandv3.1.0GPL-3.0-or-laterIn 1 marketplace
Builds strongly typed HTTP services in JavaScript that run on Node, Deno, Bun or Cloudflare Workers, with OpenAPI v3 docs and x402 pay-per-request pricing. Skills cover Drash resource conventions and decorators.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
Executables (bin/) — files in this plugin's bin/ directory are added to the Bash tool's PATH while the plugin is enabled.
1 marketplace, most starred first
JavaScript, TypeScript, OpenAPI, YAML, Node, Deno, Bun, Cloudflare
http-server, web-framework, rest-api, resource-conventions, x402, pay-per-request
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A strongly typed, runtime-agnostic web framework for building structured HTTP services in JavaScript, built on Web Standards.
Starting from an empty directory:
| Runtime | Initialize | Add Drash |
|---|---|---|
| Node | npm init -y | npm install @drashland/drash |
| Deno | deno init | deno add jsr:@drashland/drash |
| Bun | bun init -y | bun add @drashland/drash |
| Cloudflare Workers | npm init -y | npm install @drashland/drash |
Cloudflare Workers also needs Wrangler,
Cloudflare's CLI, to run a Worker locally: npm install --save-dev wrangler.
npm init -y produces a CommonJS project, which is what the Node example below
expects. For ESM, add npm pkg set type=module and import rather than
require.
On Deno both steps are optional: the example below imports the full
jsr: specifier, which resolves without a deno.json. Run deno add if you
want the version pinned there and would rather import the bare
@drashland/drash/... specifier.
Drash is published to npm and
JSR. The JSR specifiers carry no file
extension, since JSR resolves through the package's export map; the npm ones
need .js.
Note: The following example uses Node and CommonJS. View the Other Runtimes section below to find an example that fits your project.
Initialize your project and install Drash.
npm init -y && npm install @drashland/drash
Write your Drash application.
// Node's `URLPattern` support varies by version, so use the polyfill entry point
const {
Application,
Resource,
} = require("@drashland/drash/modules/http.polyfill");
const { createServer } = require("node:http");
class Home extends Resource {
paths = ["/"];
GET(context) {
context.response.end("Oh so easy");
}
}
const app = Application
.builder()
.resources(Home)
.build();
const hostname = "localhost";
const port = 1447;
const server = createServer((request, response) => {
// Node's `node:http` gives you `IncomingMessage` and `ServerResponse`,
// not a Web `Request`. Drash does not convert them for you — you hand the
// app a `context` object carrying whatever your resources need. The
// app only requires `url` and `method`.
const context = {
url: `http://${hostname}:${port}${request.url}`,
method: request.method,
request,
response,
};
return app
.handle(context)
.catch(() => {
response.statusCode = 500;
response.statusMessage = "Internal Server Error";
response.end("Sorry, but we hit an error!");
});
});
server.listen(port, hostname);
Run your app and head to open http://localhost:1447.
node app.js
The same application code runs everywhere; only the server around it changes. See the examples below to find code that fits your project's requirements.
// Node's `URLPattern` support varies by version, so use the polyfill entry point
const {
Application,
Resource,
} = require("@drashland/drash/modules/http.polyfill");
const { createServer } = require("node:http");
class Home extends Resource {
paths = ["/"];
GET(context) {
context.response.end("Oh so easy");
}
}
const app = Application
.builder()
.resources(Home)
.build();
const hostname = "localhost";
const port = 1447;
const server = createServer((request, response) => {
// Node's `node:http` gives you `IncomingMessage` and `ServerResponse`,
// not a Web `Request`. Drash does not convert them for you — you hand the
// app a `context` object carrying whatever your resources need. The
// app only requires `url` and `method`.
const context = {
url: `http://${hostname}:${port}${request.url}`,
method: request.method,
request,
response,
};
return app
.handle(context)
.catch(() => {
response.statusCode = 500;
response.statusMessage = "Internal Server Error";
response.end("Sorry, but we hit an error!");
});
});
server.listen(port, hostname);
// Requires `npm pkg set type=module`. The ESM specifier keeps its `.js`
// extension; the CommonJS one above drops it.
import {
Application,
Resource,
} from "@drashland/drash/modules/http.polyfill.js";
import { createServer } from "node:http";
class Home extends Resource {
paths = ["/"];
GET(context) {
context.response.end("Oh so easy");
}
}
const app = Application
.builder()
.resources(Home)
.build();
const hostname = "localhost";
const port = 1447;
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub drashland/drash --plugin drashPlugins from other owners that cover similar ground