Skip to content

Commit

Permalink
Started creating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cabraviva committed Apr 24, 2023
1 parent 5a01dca commit af86db3
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 13 deletions.
49 changes: 48 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,52 @@
"fullres",
"gneg",
"gunnar"
]
],
"files.exclude": {
"**/.git": false,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/.circleci": false,
"**/.compodocrc*": false,
"**/.editorconfig": false,
"**/.gitattributes": false,
"**/.github": false,
"**/.gitkeep": false,
"**/.gitignore": false,
"**/.npmrc": false,
"**/.prettierignore": false,
"**/.prettierrc*": false,
"**/.scannerwork": false,
"**/.eslint*": false,
"**/.docker*": false,
"**/docker": false,
"**/.nvmrc": false,
"**/.vscodeignore": false,
"**/.vscode": false,
"**/CHANGELOG.md": false,
"**/README.md": false,
"**/LICENSE.md": false,
"**/angular.json": false,
"**/workspace.json": false,
"**/jest-mocks.ts": false,
"**/jest.config.js": false,
"**/jest.preset.js": false,
"**/node_modules": false,
"**/nx.json": false,
"**/package-lock.json": false,
"**/package.json": false,
"**/sonar-project.properties": false,
"**/tsconfig*": false,
"**/tslint*": false,
"**/babel*": false,
"**/.babel*": false,
"**/webpack*": false,
"**/typings.d.ts": false,
"**/*.yaml": false,
"**/Makefile": false,
"**/*.sh": false
}
}
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ npm i -D knorry
```
No additional configuration required

<details>
<summary>CDN & Node</summary>

**Using a CDN (Not recommended):**
```javascript
const knorry = (await import('https://cdn.jsdelivr.net/npm/knorry@latest')).default
Expand All @@ -53,6 +56,27 @@ defineKnorryOptions({
})
```
This method is not recommended because it doesn't supports all features and you aren't in need of a lightweight client in nodejs. Use a more robust client like [axios](https://npmjs.com/package/axios) instead
</details>

# Usage
First, import all methods you need:
```js
import { get, post } from 'knorry'
```

Now you can make requests like this

Alternatively you could use the default export:
```js
import knorry from 'knorry'
knorry('POST', 'example.com', {
key: 'value'
}, {
headers: {
myHeader: '12345'
}
})
```

# Some things to keep in mind when using knorry
## Easy mode
Expand Down Expand Up @@ -111,3 +135,5 @@ await get('/whoami') == 'username'
await get('/whoami') instanceof String
!!(await get('/returns-false')).$plain() // -> false
```

If you are working on an enterprise project, you should disable easyMode by default.
106 changes: 106 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"types": "dist/main.d.ts",
"type": "module",
"scripts": {
"docs": "typedoc --out docs --entryPointStrategy expand src",
"test": "tsc && node test/test.js",
"playground": "tsc && node test/endpoints.js",
"build": "tsc && uglifyjs -o dist/main.js --compress --mangle -- dist/main.js",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build && npm run docs"
},
"repository": {
"type": "git",
Expand All @@ -36,6 +37,7 @@
"es-main": "^1.2.0",
"express": "^4.18.2",
"puppeteer": "^19.9.0",
"typedoc": "^0.24.6",
"typescript": "^5.0.4",
"uglify-js": "^3.17.4"
},
Expand Down
Loading

0 comments on commit af86db3

Please sign in to comment.