wooks 0.0.1-beta.6 → 0.0.1-beta.7
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 +45 -24
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/wooks.d.ts +5 -0
- package/dist/src/wooks.d.ts.map +1 -1
- package/dist/wooks.cjs.prod.js +24 -2766
- package/dist/wooks.d.ts +7 -559
- package/dist/wooks.esm-bundler.js +26 -2737
- package/package.json +8 -5
- package/dist/src/composables/body.d.ts +0 -17
- package/dist/src/composables/body.d.ts.map +0 -1
- package/dist/src/composables/cookies.d.ts +0 -14
- package/dist/src/composables/cookies.d.ts.map +0 -1
- package/dist/src/composables/core-test.d.ts +0 -19
- package/dist/src/composables/core-test.d.ts.map +0 -1
- package/dist/src/composables/core.d.ts +0 -30
- package/dist/src/composables/core.d.ts.map +0 -1
- package/dist/src/composables/header-accept.d.ts +0 -9
- package/dist/src/composables/header-accept.d.ts.map +0 -1
- package/dist/src/composables/header-authorization.d.ts +0 -20
- package/dist/src/composables/header-authorization.d.ts.map +0 -1
- package/dist/src/composables/header-set-cache-control.d.ts +0 -9
- package/dist/src/composables/header-set-cache-control.d.ts.map +0 -1
- package/dist/src/composables/headers.d.ts +0 -11
- package/dist/src/composables/headers.d.ts.map +0 -1
- package/dist/src/composables/hooks.d.ts +0 -20
- package/dist/src/composables/hooks.d.ts.map +0 -1
- package/dist/src/composables/index.d.ts +0 -13
- package/dist/src/composables/index.d.ts.map +0 -1
- package/dist/src/composables/proxy-utils.d.ts +0 -25
- package/dist/src/composables/proxy-utils.d.ts.map +0 -1
- package/dist/src/composables/proxy.d.ts +0 -12
- package/dist/src/composables/proxy.d.ts.map +0 -1
- package/dist/src/composables/req-res.d.ts +0 -34
- package/dist/src/composables/req-res.d.ts.map +0 -1
- package/dist/src/composables/search-params.d.ts +0 -13
- package/dist/src/composables/search-params.d.ts.map +0 -1
- package/dist/src/composables/tests/body.spec.d.ts +0 -2
- package/dist/src/composables/tests/body.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/cookies.spec.d.ts +0 -2
- package/dist/src/composables/tests/cookies.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/core.spec.d.ts +0 -2
- package/dist/src/composables/tests/core.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/headers.spec.d.ts +0 -2
- package/dist/src/composables/tests/headers.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/proxy.spec.d.ts +0 -2
- package/dist/src/composables/tests/proxy.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/req-res.spec.d.ts +0 -2
- package/dist/src/composables/tests/req-res.spec.d.ts.map +0 -1
- package/dist/src/composables/tests/search-params.spec.d.ts +0 -2
- package/dist/src/composables/tests/search-params.spec.d.ts.map +0 -1
- package/dist/src/content-types/index.d.ts +0 -97
- package/dist/src/content-types/index.d.ts.map +0 -1
- package/dist/src/errors/error-renderer.d.ts +0 -9
- package/dist/src/errors/error-renderer.d.ts.map +0 -1
- package/dist/src/errors/errors.spec.d.ts +0 -2
- package/dist/src/errors/errors.spec.d.ts.map +0 -1
- package/dist/src/errors/index.d.ts +0 -3
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/wooks-error.d.ts +0 -20
- package/dist/src/errors/wooks-error.d.ts.map +0 -1
- package/dist/src/mime/extensions.d.ts +0 -1184
- package/dist/src/mime/extensions.d.ts.map +0 -1
- package/dist/src/mime/index.d.ts +0 -2
- package/dist/src/mime/index.d.ts.map +0 -1
- package/dist/src/mime/mime.spec.d.ts +0 -2
- package/dist/src/mime/mime.spec.d.ts.map +0 -1
- package/dist/src/response/core.d.ts +0 -30
- package/dist/src/response/core.d.ts.map +0 -1
- package/dist/src/response/factory.d.ts +0 -4
- package/dist/src/response/factory.d.ts.map +0 -1
- package/dist/src/response/index.d.ts +0 -4
- package/dist/src/response/index.d.ts.map +0 -1
- package/dist/src/response/renderer.d.ts +0 -8
- package/dist/src/response/renderer.d.ts.map +0 -1
- package/dist/src/response/response.spec.d.ts +0 -2
- package/dist/src/response/response.spec.d.ts.map +0 -1
- package/dist/src/serve-file/serve-file.d.ts +0 -20
- package/dist/src/serve-file/serve-file.d.ts.map +0 -1
- package/dist/src/serve-file/serve-file.spec.d.ts +0 -2
- package/dist/src/serve-file/serve-file.spec.d.ts.map +0 -1
- package/dist/src/status-codes/index.d.ts +0 -135
- package/dist/src/status-codes/index.d.ts.map +0 -1
- package/dist/src/utils/body-compressor.d.ts +0 -8
- package/dist/src/utils/body-compressor.d.ts.map +0 -1
- package/dist/src/utils/cache-control.d.ts +0 -14
- package/dist/src/utils/cache-control.d.ts.map +0 -1
- package/dist/src/utils/set-cookie.d.ts +0 -16
- package/dist/src/utils/set-cookie.d.ts.map +0 -1
- package/dist/src/utils/tests/body-compressor.spec.d.ts +0 -2
- package/dist/src/utils/tests/body-compressor.spec.d.ts.map +0 -1
- package/dist/src/utils/tests/set-cookie.spec.d.ts +0 -2
- package/dist/src/utils/tests/set-cookie.spec.d.ts.map +0 -1
- package/dist/src/utils/tests/time.spec.d.ts +0 -2
- package/dist/src/utils/tests/time.spec.d.ts.map +0 -1
- package/dist/src/utils/tests/url-search-params.spec.d.ts +0 -2
- package/dist/src/utils/tests/url-search-params.spec.d.ts.map +0 -1
- package/dist/src/utils/time.d.ts +0 -5
- package/dist/src/utils/time.d.ts.map +0 -1
- package/dist/src/utils/url-search-params.d.ts +0 -6
- package/dist/src/utils/url-search-params.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Wooks is a Web Application Framework with hooks.
|
|
|
15
15
|
As an alternative for `express` and `fastify`, `wooks` brings the whole different approach for processing http requests.
|
|
16
16
|
It utilizes such a technique as you can see in React Hooks or Vue Composables. It has only a dependency on [@prostojs/router](https://github.com/prostojs/router) (an alternative to `find-my-way` used by `fastify`) which is a very fast (see benchmarks [here](https://github.com/prostojs/router-benchmark)) and robust URI router.
|
|
17
17
|
|
|
18
|
-
`wooks` supports cookie parsing and serving files out of the box with no impact on performance.
|
|
18
|
+
`wooks` supports cookie parsing, proxy and serving files out of the box with no impact on performance.
|
|
19
19
|
|
|
20
20
|
The main ideas behind wooks are:
|
|
21
21
|
|
|
@@ -24,11 +24,20 @@ The main ideas behind wooks are:
|
|
|
24
24
|
3. Get rid of complex predefined data objects containing everything (cookies, headers, body, parsed body etc.) and use composable functions (hooks) instead;
|
|
25
25
|
4. Get rid of tons of dependencies (middlewares) and implement everything that is needed for web app in a simple way.
|
|
26
26
|
|
|
27
|
+
`wooks` uses [@wooksjs/composables](https://github.com/wooksjs/composables) under the hood.
|
|
28
|
+
|
|
29
|
+
### Official Composables packs:
|
|
30
|
+
|
|
31
|
+
- [@wooksjs/body](https://github.com/wooksjs/body) - to parse body
|
|
32
|
+
- [@wooksjs/serve-file](https://github.com/wooksjs/serve-file) - to serve static files
|
|
33
|
+
- [@wooksjs/proxy](https://github.com/wooksjs/proxy) - to proxy requests
|
|
27
34
|
|
|
28
35
|
## Quick Start
|
|
29
36
|
|
|
30
37
|
```js
|
|
31
|
-
|
|
38
|
+
import { Wooks } from 'wooks'
|
|
39
|
+
// commonjs
|
|
40
|
+
// const { Wooks } = require('wooks')
|
|
32
41
|
|
|
33
42
|
const app = new Wooks()
|
|
34
43
|
|
|
@@ -73,7 +82,7 @@ app.get('wildcard/start-*/*.html', () => {})
|
|
|
73
82
|
To get access to URL parameters use composable function `useRouteParams`
|
|
74
83
|
|
|
75
84
|
```js
|
|
76
|
-
import { useRouteParams } from '
|
|
85
|
+
import { useRouteParams } from '@wooksjs/composables'
|
|
77
86
|
app.get('parametric/:param1/:param2/...', () => {
|
|
78
87
|
const { routeParams, getRouteParam } = useRouteParams()
|
|
79
88
|
// presume we had a request on `/parametric/value1/value2`
|
|
@@ -94,7 +103,7 @@ app.get('parametric/:param1/:param2/...', () => {
|
|
|
94
103
|
To get access to Query parameters use composable function `useSearchParams`
|
|
95
104
|
|
|
96
105
|
```js
|
|
97
|
-
import { useSearchParams } from '
|
|
106
|
+
import { useSearchParams } from '@wooksjs/composables'
|
|
98
107
|
app.get('with-query', () => {
|
|
99
108
|
const { jsonSearchParams, urlSearchParams } = useSearchParams()
|
|
100
109
|
// presume we had a request on `/with-query?param1=abc¶m2=cde`
|
|
@@ -117,7 +126,7 @@ To get a reference to the raw request instance use composable function `useReque
|
|
|
117
126
|
You probably don't need a `rawRequest` unless you are developing some new feature. All the base use-cases covered with other composable functions.
|
|
118
127
|
|
|
119
128
|
```js
|
|
120
|
-
import { useRequest } from '
|
|
129
|
+
import { useRequest } from '@wooksjs/composables'
|
|
121
130
|
app.get('test', () => {
|
|
122
131
|
const { rawRequest } = useRequest()
|
|
123
132
|
})
|
|
@@ -128,7 +137,7 @@ app.get('test', () => {
|
|
|
128
137
|
`useRequest` provides some more shortcuts for useful data
|
|
129
138
|
|
|
130
139
|
```js
|
|
131
|
-
import { useRequest } from '
|
|
140
|
+
import { useRequest } from '@wooksjs/composables'
|
|
132
141
|
app.get('test', async () => {
|
|
133
142
|
const {
|
|
134
143
|
url, // request url (string)
|
|
@@ -146,7 +155,7 @@ app.get('test', async () => {
|
|
|
146
155
|
Cookies are not parsed unless requested. Composable function `useCookies` provides cookie getter and raw cookies string.
|
|
147
156
|
|
|
148
157
|
```js
|
|
149
|
-
import { useCookies } from '
|
|
158
|
+
import { useCookies } from '@wooksjs/composables'
|
|
150
159
|
app.get('test', async () => {
|
|
151
160
|
const {
|
|
152
161
|
rawCookies, // "cookie" from headers (string | undefined)
|
|
@@ -160,6 +169,8 @@ app.get('test', async () => {
|
|
|
160
169
|
|
|
161
170
|
### Request Body Parser
|
|
162
171
|
|
|
172
|
+
`npm install @wooksjs/body`
|
|
173
|
+
|
|
163
174
|
Function `useBody` provides utilities for getting decoded and parsed body.
|
|
164
175
|
|
|
165
176
|
Body parser supports json, string, multipart/form-data and application/x-www-form-urlencoded content-types.
|
|
@@ -169,7 +180,7 @@ Body parser does not parse every request's body. The parsing happens only when y
|
|
|
169
180
|
The request handler is invoked even before the request body was sent to the server.
|
|
170
181
|
|
|
171
182
|
```js
|
|
172
|
-
import { useBody } from '
|
|
183
|
+
import { useBody } from '@wooksjs/body'
|
|
173
184
|
app.post('test', async () => {
|
|
174
185
|
const {
|
|
175
186
|
isJson, // checks if content-type is "application/json" : () => boolean;
|
|
@@ -200,7 +211,7 @@ app.post('test', async () => {
|
|
|
200
211
|
`useAuthorization` function provides useful helpers for auth-headers:
|
|
201
212
|
|
|
202
213
|
```js
|
|
203
|
-
import { useAuthorization } from '
|
|
214
|
+
import { useAuthorization } from '@wooksjs/composables'
|
|
204
215
|
app.get('test', async () => {
|
|
205
216
|
const {
|
|
206
217
|
authorization, // the raw value of "authorization" header : string
|
|
@@ -263,7 +274,7 @@ When you get a raw response instance you take away the control of the response o
|
|
|
263
274
|
|
|
264
275
|
An example of using raw response instance:
|
|
265
276
|
```js
|
|
266
|
-
import { useResponse } from '
|
|
277
|
+
import { useResponse } from '@wooksjs/composables'
|
|
267
278
|
app.get('test', () => {
|
|
268
279
|
const { rawResponse } = useResponse()
|
|
269
280
|
const res = rawResponse()
|
|
@@ -276,7 +287,7 @@ If you don't want to take away a responsibility for the response but still need
|
|
|
276
287
|
The next example does the same thing as the previous example using `passthrough` options:
|
|
277
288
|
|
|
278
289
|
```js
|
|
279
|
-
import { useResponse } from '
|
|
290
|
+
import { useResponse } from '@wooksjs/composables'
|
|
280
291
|
app.get('test', () => {
|
|
281
292
|
const { rawResponse } = useResponse()
|
|
282
293
|
const res = rawResponse({ passthrough: true })
|
|
@@ -289,7 +300,7 @@ app.get('test', () => {
|
|
|
289
300
|
A function `useSetHeaders` provides variety of response headers helpers:
|
|
290
301
|
|
|
291
302
|
```js
|
|
292
|
-
import { useSetHeaders, contentTypes } from '
|
|
303
|
+
import { useSetHeaders, contentTypes } from '@wooksjs/composables'
|
|
293
304
|
app.get('test', async () => {
|
|
294
305
|
const {
|
|
295
306
|
setHeader, //sets header: (name: string, value: string | number) => void;
|
|
@@ -309,7 +320,7 @@ app.get('test', async () => {
|
|
|
309
320
|
Another hook for set header
|
|
310
321
|
|
|
311
322
|
```js
|
|
312
|
-
import { useRespHeader } from '
|
|
323
|
+
import { useRespHeader } from '@wooksjs/composables'
|
|
313
324
|
app.get('test', async () => {
|
|
314
325
|
const server = useRespHeader('server')
|
|
315
326
|
server.value = 'myServer v1.0'
|
|
@@ -321,7 +332,7 @@ app.get('test', async () => {
|
|
|
321
332
|
A function `useSetCookies` provides variety of set-cookie helpers:
|
|
322
333
|
|
|
323
334
|
```js
|
|
324
|
-
import { useSetCookies } from '
|
|
335
|
+
import { useSetCookies } from '@wooksjs/composables'
|
|
325
336
|
app.get('test', async () => {
|
|
326
337
|
const {
|
|
327
338
|
setCookie, // sets cookie : (name: string, value: string, attrs?) => void;
|
|
@@ -345,7 +356,7 @@ app.get('test', async () => {
|
|
|
345
356
|
Another hook for set-cookie
|
|
346
357
|
|
|
347
358
|
```js
|
|
348
|
-
import { useRespCookie } from '
|
|
359
|
+
import { useRespCookie } from '@wooksjs/composables'
|
|
349
360
|
app.get('test', async () => {
|
|
350
361
|
const session = useRespCookie('session')
|
|
351
362
|
session.value = 'value'
|
|
@@ -366,7 +377,7 @@ app.get('test', async () => {
|
|
|
366
377
|
It's possible to control the response status via `status` function that is available in `useResponse()`
|
|
367
378
|
|
|
368
379
|
```js
|
|
369
|
-
import { useResponse } from '
|
|
380
|
+
import { useResponse } from '@wooksjs/composables'
|
|
370
381
|
app.get('test', async () => {
|
|
371
382
|
const { status } = useResponse()
|
|
372
383
|
status(201) // sets status 201 for the response
|
|
@@ -377,7 +388,7 @@ app.get('test', async () => {
|
|
|
377
388
|
|
|
378
389
|
Another status hook:
|
|
379
390
|
```js
|
|
380
|
-
import { useStatus } from '
|
|
391
|
+
import { useStatus } from '@wooksjs/composables'
|
|
381
392
|
app.get('test', async () => {
|
|
382
393
|
const status = useStatus()
|
|
383
394
|
status.value = 201
|
|
@@ -390,7 +401,7 @@ app.get('test', async () => {
|
|
|
390
401
|
`useSetCacheControl` function provides helpers for headers responsible for cache control
|
|
391
402
|
|
|
392
403
|
```js
|
|
393
|
-
import { useSetCacheControl } from '
|
|
404
|
+
import { useSetCacheControl } from '@wooksjs/composables'
|
|
394
405
|
app.get('static/*', () => {
|
|
395
406
|
const {
|
|
396
407
|
setAge, // sets Age (v: number | TProstoTimeMultiString) => void
|
|
@@ -417,10 +428,13 @@ app.get('static/*', () => {
|
|
|
417
428
|
|
|
418
429
|
### Proxy Requests
|
|
419
430
|
|
|
431
|
+
`npm install @wooksjs/proxy`
|
|
432
|
+
|
|
420
433
|
Wooks provides support for proxy request/response
|
|
421
434
|
|
|
422
435
|
```js
|
|
423
|
-
import { useProxy
|
|
436
|
+
import { useProxy } from '@wooksjs/proxy'
|
|
437
|
+
import { useRequest } from '@wooksjs/composables'
|
|
424
438
|
//...
|
|
425
439
|
app.get('*', async () => {
|
|
426
440
|
const proxy = useProxy()
|
|
@@ -461,11 +475,15 @@ app.get('*', async () => {
|
|
|
461
475
|
|
|
462
476
|
### Serve File (Serve-Static)
|
|
463
477
|
|
|
478
|
+
`npm install @wooksjs/serve-file`
|
|
479
|
+
|
|
464
480
|
Function `serveFile` returns a readable stream and prepares all the neccessary response headers (like content-length, content-type etc).
|
|
465
481
|
|
|
466
482
|
It can handle etag and range as well.
|
|
467
483
|
|
|
468
484
|
```js
|
|
485
|
+
import { serveFile } from '@wooksjs/serve-file'
|
|
486
|
+
// ...
|
|
469
487
|
serveFile(filePath, options)
|
|
470
488
|
```
|
|
471
489
|
|
|
@@ -502,7 +520,8 @@ serveFile(filePath, options)
|
|
|
502
520
|
Built-in file server example:
|
|
503
521
|
|
|
504
522
|
```js
|
|
505
|
-
import {
|
|
523
|
+
import { useRouteParams } from '@wooksjs/composables'
|
|
524
|
+
import { serveFile } from '@wooksjs/serve-file'
|
|
506
525
|
app.get('static/*', () => {
|
|
507
526
|
const { getRouteParam } = useRouteParams()
|
|
508
527
|
return serveFile(getRouteParam('*'), { cacheControl: { maxAge: '10m' } })
|
|
@@ -534,7 +553,7 @@ By default the Error Handler renders the response according to the `Accept` requ
|
|
|
534
553
|
It's possible to return your own error:
|
|
535
554
|
|
|
536
555
|
```js
|
|
537
|
-
import { WooksError } from '
|
|
556
|
+
import { WooksError } from '@wooksjs/composables'
|
|
538
557
|
app.get('error', () => {
|
|
539
558
|
throw new WooksError('429', 'My Description')
|
|
540
559
|
// A call of this endpoint will result in
|
|
@@ -548,7 +567,7 @@ In this case if you have an alternative (fallback) handler for the same route th
|
|
|
548
567
|
As an alternative you may not throw the error but return its instance:
|
|
549
568
|
|
|
550
569
|
```js
|
|
551
|
-
import { WooksError } from '
|
|
570
|
+
import { WooksError } from '@wooksjs/composables'
|
|
552
571
|
app.get('error', () => {
|
|
553
572
|
return new WooksError('429', 'My Description')
|
|
554
573
|
// A call of this endpoint will result in
|
|
@@ -570,7 +589,8 @@ If the previous handler returns an Error Instance then the fallback handler won'
|
|
|
570
589
|
For example you serve files, but for some 'not found' files you want to do something else:
|
|
571
590
|
|
|
572
591
|
```js
|
|
573
|
-
import { Wooks,
|
|
592
|
+
import { Wooks, useRouteParams } from '@wooksjs/composables'
|
|
593
|
+
import { serveFile } from '@wooksjs/serve-file'
|
|
574
594
|
const app = new Wooks()
|
|
575
595
|
|
|
576
596
|
app.get('static/*', () => {
|
|
@@ -590,7 +610,8 @@ app.listen(3000)
|
|
|
590
610
|
In order to prevent the fallback to be invoked you must return an Error Instance explicitly:
|
|
591
611
|
|
|
592
612
|
```js
|
|
593
|
-
import { Wooks,
|
|
613
|
+
import { Wooks, useRouteParams } from '@wooksjs/composables'
|
|
614
|
+
import { serveFile } from '@wooksjs/serve-file'
|
|
594
615
|
const app = new Wooks()
|
|
595
616
|
|
|
596
617
|
app.get('static/*', () => {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export * from './wooks';
|
|
2
|
-
export * from './errors';
|
|
3
|
-
export * from './response';
|
|
4
|
-
export * from './composables';
|
|
5
|
-
export * from './content-types';
|
|
6
|
-
export * from './status-codes';
|
|
7
|
-
export * from './serve-file/serve-file';
|
|
8
2
|
export { TWooksOptions, TWooksHandler } from './types';
|
|
9
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseWooksResponse } from '
|
|
1
|
+
import { BaseWooksResponse } from '@wooksjs/composables';
|
|
2
2
|
export interface TWooksOptions {
|
|
3
3
|
}
|
|
4
4
|
export declare type TWooksHandler<ResType = unknown> = () => Promise<ResType> | ResType | Error | Promise<Error> | BaseWooksResponse<ResType> | Promise<BaseWooksResponse<ResType>>;
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,aAAa;CAE7B;AAED,oBAAY,aAAa,CAAC,OAAO,GAAG,OAAO,IAAI,MACxC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
package/dist/src/wooks.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export declare class Wooks {
|
|
|
6
6
|
private options?;
|
|
7
7
|
protected router: ProstoRouter<TWooksHandler>;
|
|
8
8
|
protected server?: Server;
|
|
9
|
+
protected responder: {
|
|
10
|
+
createResponse: <T = unknown>(data: T) => import("@wooksjs/composables").BaseWooksResponse<T | import("@wooksjs/composables").TWooksErrorBodyExt> | null;
|
|
11
|
+
respond: (data: unknown) => void | undefined;
|
|
12
|
+
};
|
|
9
13
|
protected _uncoughtExceptionHandler: (error: Error) => void;
|
|
10
14
|
constructor(options?: TWooksOptions | undefined);
|
|
11
15
|
getRouter(): ProstoRouter<TWooksHandler<unknown>>;
|
|
@@ -17,6 +21,7 @@ export declare class Wooks {
|
|
|
17
21
|
protected processRequest(req: IncomingMessage, res: ServerResponse): void;
|
|
18
22
|
protected processHandlers(req: IncomingMessage, res: ServerResponse, found: TProstoLookupResult<TWooksHandler>): Promise<void>;
|
|
19
23
|
protected printError(expl: string, e: Error): void;
|
|
24
|
+
protected respond(data: unknown): void;
|
|
20
25
|
get<ResType = unknown, ParamsType = TProstoParamsType>(path: string, handler: TWooksHandler<ResType>): import("@prostojs/router").TProstoRouterPathBuilder<ParamsType>;
|
|
21
26
|
post<ResType = unknown, ParamsType = TProstoParamsType>(path: string, handler: TWooksHandler<ResType>): import("@prostojs/router").TProstoRouterPathBuilder<ParamsType>;
|
|
22
27
|
put<ResType = unknown, ParamsType = TProstoParamsType>(path: string, handler: TWooksHandler<ResType>): import("@prostojs/router").TProstoRouterPathBuilder<ParamsType>;
|
package/dist/src/wooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wooks.d.ts","sourceRoot":"","sources":["../../src/wooks.ts"],"names":[],"mappings":";AAAA,OA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