Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
art-emini committed Aug 30, 2021
2 parents d8296e2 + b0c55b1 commit 2ee8152
Show file tree
Hide file tree
Showing 25 changed files with 374 additions and 420 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist
lib
node_modules
release
private
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ The [Fetch Web API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/U

AxleJS supercharges fetch, with better error handling, easier to use options, can automatically follow redirects, an easier way to manage and view headers and search queries, custom response and request classes and methods, and a lot more.

## [Documentation](https://github.com/ksplatdev/AxleJS/wiki/Documenation)

## Features

1. All HTTP Restful Methods.
2. Very small, 9KB Minified and 15KB Unminified.
3. Fast and easy to use.
4. Makes fetch easier to use.
5. Asynchronous.
6. Error handling.
7. Adds cancellation to fetch api.
8. Custom Response and Request classes.
9. Written in TypeScript.
10. Built-in TypeDefs.
1. Functions for all HTTP Restful Methods.
2. Use built-in middleware or make custom middleware.
3. Very small, ~10KB Minified and ~17KB Unminified.
4. Fast and easy to use.
5. [Documentation](https://github.com/ksplatdev/AxleJS/wiki/Documenation).
6. Makes fetch easier to use.
7. Better Error handling.
8. Adds cancellation to fetch api.
9. Custom and Extended Response and Request classes.
10. Written in TypeScript.
11. Built-in TypeDefs.

## How to Download

Expand All @@ -33,18 +36,18 @@ AxleJS supercharges fetch, with better error handling, easier to use options, ca
1. Download the [latest release](https://github.com/ksplatdev/AxleJS/releases/latest) from GitHub.
2. Unzip and move contents into your project.
3. Import AxleJS with the [ES6 Import Syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
4. Read the documentation.
4. Read the [documentation](https://github.com/ksplatdev/AxleJS/wiki/Documenation).

### NPM

1. Run `npm i axlejs`.
2. Import AxleJS with the [ES6 Import Syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
3. Read the documentation.
3. Read the [documentation](https://github.com/ksplatdev/AxleJS/wiki/Documenation).

### CDN

1. Import from <https://cdn.jsdelivr.net/npm/axlejs@1.0.0/dist/index.js> or for minified version <https://cdn.jsdelivr.net/npm/axlejs@1.0.0/dist/index.min.js>.
2. Read the documentation.
1. Import from <https://cdn.jsdelivr.net/npm/axlejs@1.1.0/dist/index.js> or for minified version <https://cdn.jsdelivr.net/npm/axlejs@1.1.0/dist/index.min.js>.
2. Read the [documentation](https://github.com/ksplatdev/AxleJS/wiki/Documenation).

## Quick Start

Expand Down Expand Up @@ -175,8 +178,9 @@ For more info, read the documentation.
9. Test your changes on codesandbox or any other platform.
10. Stage, Commit, and Push your changes on your branch.
11. Create a pull request to merge onto the staging branch.
12. Wait for your pull request to be reviewed and possibly merged.
13. Thanks for contributing!
12. State all changes as a changelog in the pull request.
13. Wait for your pull request to be reviewed and possibly merged.
14. Thanks for contributing!

### File Structure

Expand Down
18 changes: 18 additions & 0 deletions examples/cancelRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Axle from '../dist/index';

// setup cancel
const cancelMark = new Axle.cancelMark();
const cancelSignal = cancelMark.signal;

(async function test() {
const json = await (
await Axle.get('https://dog.ceo/api/breeds/image/random', {
signal: cancelSignal,
})
).json();

console.log(json.message); // dog image url

// cancel with message, optional
cancelMark.cancel('Canceled Request');
})();
26 changes: 26 additions & 0 deletions examples/useMiddleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Axle from '../dist/index';

// custom middleware
Axle.use((req, res) => {
if (res.query['id']) {
console.log(`ID: ${res.queryParam('id')}`);
} else {
console.log('Different URL, no ID found');
}
});

// built-in middleware
Axle.use(Axle.middleware.timeTook());

// built-in middleware options
Axle.useOptions({
...Axle.middlewareOptions.cors(),
...Axle.middlewareOptions.kneepads(),
});

(async function test() {
const res = await Axle.get('https://dog.ceo/api/breeds/image/random');
const json = await res.json();

console.log(json.message); // random dog url
})();
Loading

0 comments on commit 2ee8152

Please sign in to comment.