README
[WIP] API
Promise based HTTP request API for Node.js
⏰ Short Example
// Let't create our API
const api = new API({
baseURL: 'https://myapp.com', // Base Route to the Host
timeout: 10000, // After which amount of time a request times out
options: { credentials: 'include' } // Http/s Request Options from type RequestInit
});
// Now we can create our first Request to 'https://myapp.com/hello'
const response = await api.get('/hello');
console.log(response);
/*
{
data: {hello: "Jeff"}; // Response Data
timedout: false; // If Request has timedout
status: 200; // Response Status Code
raw: Response; // Raw Response from type Response
type: "application/json"; // Response Type
}
*/
❓ Why Agile Api
🚅 Straightforward
Write minimalistic, boilerplate free code that captures your intent.
For instance
- Automatic transform for JSON data
- Configurable Timeout
🎯 Easy to Use
Learn the powerful and simple tools of Agile Api in a short amount of time.
🍃 Lightweight
Agile Api has an unpacked size of 2kB and 0 external dependencies.
⬇️ Installation
npm install @agile-ts/api
Be aware that this is no standalone package!
To use the Agile Api you have to install the Agile Core.
To find out more take a look into the docs.
🔑 Fitting Versions
@agile-ts/api | @agile-ts/core | NPM Version |
---|---|---|
v0.0.7 | v0.0.1+ | v6+ |
v0.0.6 | v0.0.1+ | v6+ |
Other Versions aren't supported anymore |
📄 Documentation
The Agile Api Docs are located here