Socket
Socket
Sign inDemoInstall

exegesis-express

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exegesis-express - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

19

package.json
{
"name": "exegesis-express",
"version": "3.0.0",
"version": "4.0.0",
"description": "Express middleware to handle OpenAPI 3.x.",

@@ -53,3 +53,3 @@ "main": "dist/index.js",

"dependencies": {
"exegesis": "^3.0.0"
"exegesis": "^4.1.0"
},

@@ -60,4 +60,4 @@ "devDependencies": {

"@types/express": "^4.16.1",
"@types/mocha": "^8.2.2",
"@types/node": "^15.0.3",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.12",
"chai": "^4.2.0",

@@ -67,9 +67,10 @@ "chai-as-promised": "^7.1.1",

"express": "^4.16.4",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"mocha": "^8.4.0",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"mocha": "^9.1.3",
"nyc": "^15.0.1",
"semantic-release": "^17.4.3",
"pretty-quick": "^3.1.2",
"semantic-release": "^18.0.1",
"supertest-fetch": "^1.2.4",
"ts-node": "^9.1.1",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",

@@ -76,0 +77,0 @@ "typescript": "^4.2.4"

# exegesis-express
[![NPM version](https://badge.fury.io/js/exegesis-express.svg)](https://npmjs.org/package/exegesis-express)
[![Build Status](https://travis-ci.org/exegesis-js/exegesis-express.svg)](https://travis-ci.org/exegesis-js/exegesis-express)
![Build Status](https://github.com/exegesis-js/exegesis-express/workflows/GitHub%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/exegesis-js/exegesis-express/badge.svg)](https://coveralls.io/r/exegesis-js/exegesis-express)

@@ -9,5 +9,5 @@ [![Greenkeeper badge](https://badges.greenkeeper.io/exegesis-js/exegesis-express.svg)](https://greenkeeper.io/)

> ## *exegesis*
> ## _exegesis_
>
> *n.* An explanation or critical interpretation of a text, especially an
> _n._ An explanation or critical interpretation of a text, especially an
> API definition document.

@@ -22,9 +22,9 @@ >

* Full support for OpenAPI 3.x.x (see [issues tagged with conformance](https://github.com/exegesis-js/exegesis/issues?q=is%3Aissue+is%3Aopen+label%3Aconformance) for areas which could use some improvement).
* Built in support for "application/json" and "application/x-www-form-urlencoded" requests
* Can use express [body parser middlewares](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#mimetypeparsers)
* [Response validation](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#onresponsevalidationerror)
* [Authentication support](https://github.com/exegesis-js/exegesis/blob/master/docs/OAS3%20Security.md)
* [Plugins](https://github.com/exegesis-js/exegesis/tree/master/docs) allow easy extensibility
* Easy support for [validating custom formats](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#customformats)
- Full support for OpenAPI 3.x.x (see [issues tagged with conformance](https://github.com/exegesis-js/exegesis/issues?q=is%3Aissue+is%3Aopen+label%3Aconformance) for areas which could use some improvement).
- Built in support for "application/json" and "application/x-www-form-urlencoded" requests
- Can use express [body parser middlewares](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#mimetypeparsers)
- [Response validation](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#onresponsevalidationerror)
- [Authentication support](https://github.com/exegesis-js/exegesis/blob/master/docs/OAS3%20Security.md)
- [Plugins](https://github.com/exegesis-js/exegesis/tree/master/docs) allow easy extensibility
- Easy support for [validating custom formats](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md#customformats)

@@ -43,10 +43,10 @@ ## Tutorial

`openApiFile` is either a path to your openapi.yaml or openapi.json file,
or it can be a JSON object with the contents of your OpenAPI document. This
or it can be a JSON object with the contents of your OpenAPI document. This
should have the [`x-exegesis-controller`](https://github.com/exegesis-js/exegesis/blob/master/docs/OAS3%20Specification%20Extensions.md)
extension defined on any paths you want to be able to access.
`options` can be [anything you can pass to exegesis](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md). At a
`options` can be [anything you can pass to exegesis](https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md). At a
minimum, you'll probably want to provide `options.controllers`, a path to where
your [controller modules](https://github.com/exegesis-js/exegesis/blob/master/docs/Exegesis%20Controllers.md)
can be found. If you have any security requirements defined, you'll also
can be found. If you have any security requirements defined, you'll also
want to pass in some [authenticators](https://github.com/exegesis-js/exegesis/blob/master/docs/OAS3%20Security.md).

@@ -56,3 +56,3 @@ To enable response validation, you'll want to provide a validation callback

Exegesis's functionality can also be extended using [plugins](https://github.com/exegesis-js/exegesis/tree/master/docs),
which run on every request. Plugins let you add functionality like
which run on every request. Plugins let you add functionality like
[role base authorization](https://github.com/exegesis-js/exegesis-plugin-roles),

@@ -64,4 +64,4 @@ or CORS.

Exegesis-express should appear near the top of your middleware stack, before
any body parsers. This is because exegesis will take care of parsing the body
for you, and it can't do that if the body has already been read. If you put
any body parsers. This is because exegesis will take care of parsing the body
for you, and it can't do that if the body has already been read. If you put
a body parser ahead of exegesis-express, exegesis will try to use `req.body`

@@ -72,7 +72,7 @@ if it's there.

OpenAPI 3.x lets you specify what servers your API is available on. For example:
OpenAPI 3.x lets you specify what servers your API is available on. For example:
```yaml
servers:
- url: '/api/v2'
- url: "/api/v2"
```

@@ -89,11 +89,11 @@

If you specify the `ignoreServers` option, however, exegesis will ignore the
servers section, an route purely based on your paths. This lets you do
servers section, an route purely based on your paths. This lets you do
something like:
```js
const exegesisMiddleware = await exegesisExpress.middleware(
path.resolve(__dirname, './openapi.yaml'),
{ignorePaths: true}
);
app.use('/api/v2', exegesisMiddleware);
const exegesisMiddleware = await exegesisExpress.middleware(
path.resolve(__dirname, "./openapi.yaml"),
{ ignorePaths: true }
);
app.use("/api/v2", exegesisMiddleware);
```

@@ -106,33 +106,33 @@

```js
import express from 'express';
import path from 'path';
import http from 'http';
import * as exegesisExpress from 'exegesis-express';
import express from "express";
import path from "path";
import http from "http";
import * as exegesisExpress from "exegesis-express";
async function createServer() {
// See https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md
const options = {
controllers: path.resolve(__dirname, './controllers')
};
// See https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md
const options = {
controllers: path.resolve(__dirname, "./controllers"),
};
const exegesisMiddleware = await exegesisExpress.middleware(
path.resolve(__dirname, './openapi.yaml'),
options
);
const exegesisMiddleware = await exegesisExpress.middleware(
path.resolve(__dirname, "./openapi.yaml"),
options
);
const app = express();
const app = express();
// If you have any body parsers, this should go before them.
app.use(exegesisMiddleware);
// If you have any body parsers, this should go before them.
app.use(exegesisMiddleware);
app.use((req, res) => {
res.status(404).json({message: `Not found`});
});
app.use((req, res) => {
res.status(404).json({ message: `Not found` });
});
app.use((err, req, res, next) => {
res.status(500).json({message: `Internal error: ${err.message}`});
});
app.use((err, req, res, next) => {
res.status(500).json({ message: `Internal error: ${err.message}` });
});
const server = http.createServer(app);
server.listen(3000);
const server = http.createServer(app);
server.listen(3000);
}

@@ -139,0 +139,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc