@fatcherjs/middleware-json 1.0.0 → 1.4.0

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 CHANGED
@@ -1,31 +1,42 @@
1
1
  # @fatcherjs/middleware-json
2
2
 
3
- A fatcher middleware for transforming stream into json.
3
+ A middleware for transform response to JSON
4
4
 
5
5
  ## Install
6
6
 
7
+ ### NPM
8
+
7
9
  ```bash
8
10
  >$ npm install @fatcherjs/middleware-json
9
11
  ```
10
12
 
13
+ ### CDN
14
+
15
+ ```html
16
+ <script src="https://cdn.jsdelivr.net/npm/@fatcherjs/middleware-json/dist/json.min.js"></script>
17
+ ```
18
+
11
19
  ## Usage
12
20
 
13
21
  ```ts
14
- import { fatcher } from 'fatcher';
15
22
  import { json } from '@fatcherjs/middleware-json';
23
+ import { fatcher } from 'fatcher';
16
24
 
17
25
  fatcher({
18
26
  url: '/bar/foo',
19
27
  middlewares: [json()],
28
+ payload: {
29
+ bar: 'foo',
30
+ },
20
31
  })
21
32
  .then(res => {
22
- console.log(res.data); // json data.
33
+ console.log(res);
23
34
  })
24
35
  .catch(err => {
25
- console.error(err);
36
+ console.error(error);
26
37
  });
27
38
  ```
28
39
 
29
40
  ## License
30
41
 
31
- [MIT](../../LICENSE)
42
+ [LICENSE](https://github.com/fatcherjs/fatcher/blob/master/LICENSE)
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@fatcherjs/middleware-json",
3
- "version": "1.0.0",
4
- "main": "dist/index.js",
5
- "module": "dist/index.esm.js",
6
- "browser": "dist/index.min.js",
7
- "typings": "dist/index.d.ts",
8
- "repository": "https://github.com/fatcherjs/middlewares/tree/master/packages/json",
3
+ "version": "1.4.0",
4
+ "main": "dist/json.js",
5
+ "module": "dist/json.esm.js",
6
+ "browser": "dist/json.min.js",
7
+ "typings": "dist/json.d.ts",
8
+ "license": "MIT",
9
9
  "description": "A fatcher middleware for transforming stream into json",
10
10
  "keywords": [
11
11
  "fatcher",
@@ -15,12 +15,17 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "homepage": "https://github.com/fatcherjs/fatcher/tree/master/packages/json",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/fatcherjs/fatcher.git"
22
+ },
18
23
  "peerDependencies": {
19
24
  "fatcher": "^1.0.0"
20
25
  },
21
26
  "scripts": {
22
27
  "dev": "rimraf dist && rollup -c rollup.config.ts -w",
23
- "build": "rimraf dist && rollup -c rollup.config.ts"
24
- },
25
- "readme": "# @fatcherjs/middleware-json\n\nA fatcher middleware for transforming stream into json.\n\n## Install\n\n```bash\n>$ npm install @fatcherjs/middleware-json\n```\n\n## Usage\n\n```ts\nimport { fatcher } from 'fatcher';\nimport { json } from '@fatcherjs/middleware-json';\n\nfatcher({\n url: '/bar/foo',\n middlewares: [json()],\n})\n .then(res => {\n console.log(res.data); // json data.\n })\n .catch(err => {\n console.error(err);\n });\n```\n\n## License\n\n[MIT](../../LICENSE)\n"
28
+ "build": "rimraf dist && rollup -c rollup.config.ts",
29
+ "deploy": "pnpm run build && pnpm publish --no-git-check"
30
+ }
26
31
  }