@scalar/hono-api-reference 0.7.3 → 0.7.5
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 +17 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,13 +25,26 @@ import { apiReference } from '@scalar/hono-api-reference'
|
|
|
25
25
|
app.get(
|
|
26
26
|
'/reference',
|
|
27
27
|
apiReference({
|
|
28
|
-
url: '/
|
|
28
|
+
url: '/doc',
|
|
29
29
|
}),
|
|
30
30
|
)
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
The Hono middleware takes our universal configuration object, [read more about configuration](https://github.com/scalar/scalar/blob/main/documentation/configuration.md) in the core package README.
|
|
34
34
|
|
|
35
|
+
### CORS middleware
|
|
36
|
+
|
|
37
|
+
We recommend to allow requests from other domains to your API definition. That makes it easier to use your API with [our free web client](https://client.scalar.com/) for example.
|
|
38
|
+
|
|
39
|
+
You just need to add the official Hono CORS middleware to the route of your OpenAPI document:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { cors } from 'hono/cors'
|
|
43
|
+
|
|
44
|
+
// Recommended: Allows cross-origin requests (from other domains) to your OpenAPI document
|
|
45
|
+
app.use('/doc', cors())
|
|
46
|
+
```
|
|
47
|
+
|
|
35
48
|
### Themes
|
|
36
49
|
|
|
37
50
|
The middleware comes with a custom theme for Hono. You can use one of [the other predefined themes](https://github.com/scalar/scalar/blob/main/packages/themes/src/index.ts#L15) (`alternate`, `default`, `moon`, `purple`, `solarized`) or overwrite it with `none`. All themes come with a light and dark color scheme.
|
|
@@ -43,7 +56,7 @@ app.get(
|
|
|
43
56
|
'/reference',
|
|
44
57
|
apiReference({
|
|
45
58
|
theme: 'purple',
|
|
46
|
-
url: '/
|
|
59
|
+
url: '/doc',
|
|
47
60
|
}),
|
|
48
61
|
)
|
|
49
62
|
```
|
|
@@ -59,7 +72,7 @@ app.get(
|
|
|
59
72
|
'/reference',
|
|
60
73
|
apiReference({
|
|
61
74
|
pageTitle: 'Hono API Reference',
|
|
62
|
-
url: '/
|
|
75
|
+
url: '/doc',
|
|
63
76
|
}),
|
|
64
77
|
)
|
|
65
78
|
```
|
|
@@ -79,7 +92,7 @@ app.use(
|
|
|
79
92
|
'/reference',
|
|
80
93
|
apiReference({
|
|
81
94
|
cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest',
|
|
82
|
-
url: '/
|
|
95
|
+
url: '/doc',
|
|
83
96
|
}),
|
|
84
97
|
)
|
|
85
98
|
```
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "git+https://github.com/scalar/scalar.git",
|
|
11
11
|
"directory": "integrations/hono"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.7.
|
|
13
|
+
"version": "0.7.5",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"module": "dist/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scalar/core": "0.2.
|
|
32
|
+
"@scalar/core": "0.2.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hono/node-server": "^1.11.0",
|