Registry / web-framework / osprey-middleware

osprey-middleware

JSON →
library0.5.0jsnpmunverified

Osprey-middleware is an Express.js middleware designed to integrate the Osprey RAML-based API framework directly into Express applications. Its primary function is to enable request and response validation, routing, and other API governance features as defined by a RAML specification, by exposing the Osprey API definition as an Express router. The package currently stands at version 0.5.0, indicating it never reached a stable 1.0 release. Given the lack of recent updates to this specific package (last commit ~4 years ago as of April 2026) and the core 'osprey' framework (last npm publish July 2020), its release cadence is effectively stalled. This package differentiates itself by its tight integration with the RAML API description language, promoting a documentation-first approach for Node.js Express applications, but its abandonment means it is not actively maintained or developed.

npm install osprey-middleware
INSTALL
IMPORT
SIG · OSPREY-MIDDLEWARE
O
osprey-middleware
web-frameworkjavascriptv0.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ospreyMiddleware
const ospreyMiddleware = require('osprey-middleware');
import ospreyMiddleware from 'osprey-middleware';
This package is CommonJS-only and does not provide ESM exports. Direct `import` statements will fail.
Router().use
express.Router().use(ospreyMiddleware(ramlPath, options));
ospreyMiddleware returns an Express-compatible middleware function that can be used with `app.use()` or `router.use()`.

This quickstart initializes an Express application and integrates osprey-middleware using a dummy RAML definition, setting up a basic API endpoint.

const express = require('express'); const osprey = require('osprey'); const ospreyMiddleware = require('osprey-middleware'); const path = require('path'); const app = express(); const ramlPath = path.join(__dirname, 'api.raml'); // Path to your RAML definition file // A simplified RAML file content for demonstration // In a real scenario, this would be a physical file. const dummyRamlContent = `#%RAML 1.0 title: My API version: v1 baseUri: /api /users: get: responses: 200: body: application/json: example: { "users": [ { "id": 1, "name": "Test User" } ] }`; // In a real application, you'd load from 'ramlPath' // For this example, we'll directly use 'osprey.create' with dummy content // Assuming osprey.create is available and handles string input or a mock file system osprey.create(dummyRamlContent, { server: { notFoundHandler: false } }) .then(apiMiddleware => { // ospreyMiddleware wraps the apiMiddleware generated by osprey app.use('/v1', ospreyMiddleware(apiMiddleware)); app.listen(3000, () => { console.log('Server running on http://localhost:3000'); console.log('Try accessing http://localhost:3000/v1/users (GET)'); }); }) .catch(err => { console.error('Failed to load RAML or start Osprey:', err); process.exit(1); });
Debug
Known issues
breakingThis package is effectively abandoned, with no updates since 2022 (last commit). It is unlikely to be compatible with modern Node.js versions (e.g., Node.js 18+ or 20+) or recent major versions of Express. Expect runtime errors and stability issues.
fix
Consider migrating to an actively maintained API validation and routing solution, preferably one supporting OpenAPI/Swagger, as RAML adoption has waned. If using for legacy, pin Node.js and Express versions to those compatible with the 2020-2022 timeframe.
affects: 0.5.0
gotchaSecurity vulnerabilities may exist in this package or its dependencies. As it is abandoned, there will be no patches or updates to address newly discovered security flaws, potentially exposing your application.
fix
Avoid using this package in production environments or for new projects. If absolutely necessary for a legacy system, ensure it runs in an isolated, sandboxed environment with strict network access controls and consider extensive manual security auditing.
affects: 0.5.0
gotchaThe package is tightly coupled with RAML for API definitions. RAML has seen declining adoption compared to OpenAPI/Swagger. This can lead to a niche development ecosystem and difficulty finding resources or other compatible tools.
fix
Evaluate if your project truly requires RAML. If not, consider API frameworks that support OpenAPI/Swagger specifications for better tooling and community support. Manual conversion of RAML to OpenAPI might be an option, followed by migration to a different middleware.
affects: 0.5.0
Errors
Common errors & fixes
Error: Cannot find module 'osprey-middleware'
The package was not installed, or Node.js cannot resolve its path.
fix
Ensure 'osprey-middleware' is listed in your `package.json` dependencies and run `npm install`.
Error: RAML validation failed: ... (details of validation error)
An incoming request did not conform to the RAML specification defined for the endpoint, or the RAML file itself has syntax errors.
fix
Review the RAML definition file for correctness and ensure incoming requests (headers, query parameters, body) precisely match the defined schema. Use a RAML linter or validator during development.
TypeError: app.use() requires middleware functions but got a [object Undefined]
`ospreyMiddleware` or the underlying `osprey` call did not return a valid Express middleware function, possibly due to an error in `osprey.create` or `osprey.loadFile`.
fix
Verify that your RAML file path is correct and accessible. Ensure `osprey.create` or `osprey.loadFile` executes successfully and returns the expected middleware instance, handling its Promise resolution correctly.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
expressrequiredRequired for creating and managing web servers and routing; osprey-middleware is designed to function as an Express router middleware.
ospreyrequiredThe core RAML API framework that osprey-middleware integrates with. Provides the underlying logic for RAML parsing, validation, and routing.
Agent activity
2 hits · last 30 days
node
2
Resources
osprey-middleware — npm install osprey-middleware · libregistry