@extk/expressive 0.5.4 → 0.5.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 +12 -4
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/index.mjs +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,9 +60,13 @@ const swaggerDoc = swaggerBuilder()
|
|
|
60
60
|
.withServers([{ url: 'http://localhost:3000' }])
|
|
61
61
|
.get();
|
|
62
62
|
|
|
63
|
-
// 3. Build the Express app
|
|
63
|
+
// 3. Build the Express app
|
|
64
64
|
const app = expressiveServer()
|
|
65
|
-
.
|
|
65
|
+
.withHelmet()
|
|
66
|
+
.withQs()
|
|
67
|
+
.withMorgan()
|
|
68
|
+
.withSwagger({ path: '/api-docs', doc: swaggerDoc })
|
|
69
|
+
.get();
|
|
66
70
|
|
|
67
71
|
// 4. Define routes — they auto-register in the OpenAPI spec
|
|
68
72
|
const { router, addRoute } = expressiveRouter({
|
|
@@ -203,7 +207,10 @@ export const loginSchema = z.object({
|
|
|
203
207
|
import z from 'zod';
|
|
204
208
|
|
|
205
209
|
const app = expressiveServer()
|
|
206
|
-
.
|
|
210
|
+
.withHelmet()
|
|
211
|
+
.withQs()
|
|
212
|
+
.withMorgan()
|
|
213
|
+
.withSwagger({
|
|
207
214
|
doc: swaggerBuilder()
|
|
208
215
|
.withInfo({ title: 'My API' })
|
|
209
216
|
.withServers([{ url: 'http://localhost:3000/api' }])
|
|
@@ -211,7 +218,8 @@ const app = expressiveServer()
|
|
|
211
218
|
.withSecuritySchemes({ auth: SWG.securitySchemes.BearerAuth() })
|
|
212
219
|
.withDefaultSecurity([SWG.security('auth')])
|
|
213
220
|
.get(),
|
|
214
|
-
})
|
|
221
|
+
})
|
|
222
|
+
.get();
|
|
215
223
|
```
|
|
216
224
|
|
|
217
225
|
**3. Reference them in routes with `SWG.jsonSchemaRef`:**
|
package/dist/index.d.mts
CHANGED
|
@@ -175,7 +175,6 @@ declare class ServerBuilder {
|
|
|
175
175
|
withMorgan(format?: string, // TODO: FormatFn
|
|
176
176
|
options?: Parameters<typeof morgan>[1]): this;
|
|
177
177
|
withSwagger(swagger: SwaggerOptions, ...handlers: ExpressHandler[]): this;
|
|
178
|
-
withDefaults(swagger: SwaggerOptions): express__default.Express;
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
declare class ApiError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -175,7 +175,6 @@ declare class ServerBuilder {
|
|
|
175
175
|
withMorgan(format?: string, // TODO: FormatFn
|
|
176
176
|
options?: Parameters<typeof morgan>[1]): this;
|
|
177
177
|
withSwagger(swagger: SwaggerOptions, ...handlers: ExpressHandler[]): this;
|
|
178
|
-
withDefaults(swagger: SwaggerOptions): express__default.Express;
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
declare class ApiError extends Error {
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED