Skip to main content

@rster/worker-express

This package is a worker implementation for rster. It allows you to run your rster application on an express webserver.

Installation

npm install @rster/worker-express

alternatively you can use yarn

yarn add @rster/worker-express

Usage

import { rest } from "rster";
import express from "express";
import "@rster/worker-express";

const api = rest(function () {
// ...
});

const app = express();

app.use(api.express());

If you want to use a custom path you can configure the express mixin like this:

app.use(
api.express({
basePath: "/api",
})
);

You can also configure whether the express mixin should handle 404 errors or not:

app.use(
api.express({
send404: true,
})
);