@scalar/express-api-reference 0.4.165 → 0.4.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -21
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,35 +15,18 @@ npm install @scalar/express-api-reference
|
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
|
-
[Set up Express](https://expressjs.com/en/starter/hello-world.html) and pass an OpenAPI/Swagger
|
|
18
|
+
[Set up Express](https://expressjs.com/en/starter/hello-world.html) and pass an URL to an OpenAPI/Swagger document to the `apiReference` middleware:
|
|
19
19
|
|
|
20
20
|
> Wait, but how do we get the OpenApiSpecification? 🤔 There are multiple ways to generate an OpenAPI/Swagger file for Express. The most popular way is to use [`swagger-jsdoc`](https://github.com/Surnet/swagger-jsdoc).
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { apiReference } from '@scalar/express-api-reference'
|
|
24
24
|
|
|
25
|
-
const OpenApiSpecification =
|
|
26
|
-
/* … */
|
|
27
|
-
|
|
28
|
-
app.use(
|
|
29
|
-
'/reference',
|
|
30
|
-
apiReference({
|
|
31
|
-
spec: {
|
|
32
|
-
content: OpenApiSpecification,
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If you’re serving an OpenAPI/Swagger file already, you can pass an URL, too:
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
import { apiReference } from '@scalar/express-api-reference'
|
|
42
|
-
|
|
43
25
|
app.use(
|
|
44
26
|
'/reference',
|
|
45
27
|
apiReference({
|
|
46
28
|
spec: {
|
|
29
|
+
// Put your OpenAPI url here:
|
|
47
30
|
url: '/openapi.json',
|
|
48
31
|
},
|
|
49
32
|
}),
|
|
@@ -64,7 +47,7 @@ app.use(
|
|
|
64
47
|
apiReference({
|
|
65
48
|
theme: 'purple',
|
|
66
49
|
spec: {
|
|
67
|
-
|
|
50
|
+
url: '/openapi.json',
|
|
68
51
|
},
|
|
69
52
|
}),
|
|
70
53
|
)
|
|
@@ -82,7 +65,7 @@ app.use(
|
|
|
82
65
|
apiReference({
|
|
83
66
|
cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
|
|
84
67
|
spec: {
|
|
85
|
-
|
|
68
|
+
url: '/openapi.json',
|
|
86
69
|
},
|
|
87
70
|
}),
|
|
88
71
|
)
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/scalar/scalar.git",
|
|
11
11
|
"directory": "packages/express-api-reference"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.4.
|
|
13
|
+
"version": "0.4.167",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
],
|
|
35
35
|
"module": "dist/index.js",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@scalar/types": "0.0.
|
|
37
|
+
"@scalar/types": "0.0.19"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/express": "^4.17.21",
|
|
41
|
-
"express": "^4.
|
|
41
|
+
"express": "^4.21.1",
|
|
42
42
|
"tsup": "^7.2.0",
|
|
43
|
-
"vite": "^5.
|
|
43
|
+
"vite": "^5.4.9",
|
|
44
44
|
"vitest": "^1.6.0",
|
|
45
|
-
"@scalar/api-reference": "1.25.
|
|
45
|
+
"@scalar/api-reference": "1.25.59"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsup ./src/index.ts --format esm,cjs --dts",
|