wooks 0.2.18 → 0.2.20
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 +10 -8
- package/dist/index.d.ts +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ Wooks is a Event Processing Framework based on composable (hooks) functions.
|
|
|
14
14
|
`wooks` + `@wooksjs/event-http` = Web Application Framework with hooks.
|
|
15
15
|
|
|
16
16
|
As an alternative for `express` and `fastify`, `wooks` brings the whole different approach for processing http requests.
|
|
17
|
-
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
|
+
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.
|
|
18
18
|
|
|
19
19
|
### HTTP Composables packs:
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
21
|
+
- [@wooksjs/event-http](https://github.com/wooksjs/wooksjs/tree/main/packages/event-http) - HTTP event package with core functionality
|
|
22
|
+
- [@wooksjs/http-body](https://github.com/wooksjs/wooksjs/tree/main/packages/http-body) - to parse body
|
|
23
|
+
- [@wooksjs/http-static](https://github.com/wooksjs/wooksjs/tree/main/packages/http-static) - to serve static files
|
|
24
|
+
- [@wooksjs/http-proxy](https://github.com/wooksjs/wooksjs/tree/main/packages/http-proxy) - to proxy requests
|
|
25
25
|
|
|
26
26
|
## Install
|
|
27
27
|
|
|
@@ -37,15 +37,17 @@ import { createHttpApp } from '@wooksjs/event-http'
|
|
|
37
37
|
|
|
38
38
|
const app = createHttpApp()
|
|
39
39
|
|
|
40
|
-
app.on('GET', 'hello/:name', () => `Hello ${
|
|
40
|
+
app.on('GET', 'hello/:name', () => `Hello ${useRouteParams().get('name')}!`)
|
|
41
41
|
|
|
42
42
|
// shortcuts for some methods are supported:
|
|
43
43
|
// app.get('hello/:name', () => `Hello ${ useRouteParams().get('name') }!`)
|
|
44
44
|
|
|
45
|
-
app.listen(3000, () => {
|
|
45
|
+
app.listen(3000, () => {
|
|
46
|
+
console.log('Wooks Server is up on port 3000')
|
|
47
|
+
})
|
|
46
48
|
```
|
|
47
|
-
See full documentation for http event [here](https://github.com/wooksjs/wooksjs/tree/main/packages/event-http)
|
|
48
49
|
|
|
50
|
+
See full documentation for http event [here](https://github.com/wooksjs/wooksjs/tree/main/packages/event-http)
|
|
49
51
|
|
|
50
52
|
## Documentation
|
|
51
53
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ProstoRouter } from '@prostojs/router';
|
|
|
2
2
|
import { TConsoleBase } from '@prostojs/logger';
|
|
3
3
|
import { TEventOptions } from '@wooksjs/event-core';
|
|
4
4
|
import { TProstoLoggerOptions } from '@prostojs/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { TProstoRouterPathHandle } from '@prostojs/router';
|
|
6
6
|
|
|
7
7
|
export declare function getGlobalWooks(logger?: TConsoleBase): Wooks;
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ export declare class Wooks {
|
|
|
25
25
|
getLogger(topic: string): TConsoleBase;
|
|
26
26
|
getLoggerOptions(): TProstoLoggerOptions;
|
|
27
27
|
lookup(method: string, path: string): TWooksHandler<unknown>[] | null;
|
|
28
|
-
on<ResType = unknown, ParamsType = Record<string, string | string[]>>(method: string, path: string, handler: TWooksHandler<ResType>):
|
|
28
|
+
on<ResType = unknown, ParamsType = Record<string, string | string[]>>(method: string, path: string, handler: TWooksHandler<ResType>): TProstoRouterPathHandle<ParamsType>;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export declare class WooksAdapterBase {
|
|
@@ -35,7 +35,7 @@ export declare class WooksAdapterBase {
|
|
|
35
35
|
getLogger(topic: string): TConsoleBase;
|
|
36
36
|
protected getLoggerOptions(): TProstoLoggerOptions<Record<string, never>>;
|
|
37
37
|
protected mergeEventOptions(opts?: TEventOptions): TEventOptions;
|
|
38
|
-
on<ResType = unknown, ParamsType = Record<string, string | string[]>>(method: string, path: string, handler: TWooksHandler<ResType>):
|
|
38
|
+
on<ResType = unknown, ParamsType = Record<string, string | string[]>>(method: string, path: string, handler: TWooksHandler<ResType>): TProstoRouterPathHandle<ParamsType>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wooks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "wooks",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@prostojs/router": "^0.0
|
|
35
|
-
"@prostojs/logger": "^0.3.
|
|
36
|
-
"@wooksjs/event-core": "0.2.
|
|
34
|
+
"@prostojs/router": "^0.1.0",
|
|
35
|
+
"@prostojs/logger": "^0.3.6",
|
|
36
|
+
"@wooksjs/event-core": "0.2.20"
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/wooks#readme"
|
|
39
39
|
}
|