Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iamnnort/request
Request handler for Node.js - Fast - Interactive - Simple
https://github.com/iamnnort/request
ajax fetch http promise request xhr
Last synced: 10 days ago
JSON representation
Request handler for Node.js - Fast - Interactive - Simple
- Host: GitHub
- URL: https://github.com/iamnnort/request
- Owner: iamnnort
- License: mit
- Created: 2023-09-23T10:28:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-05T00:46:31.000Z (10 days ago)
- Last Synced: 2024-11-05T00:52:30.237Z (10 days ago)
- Topics: ajax, fetch, http, promise, request, xhr
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@iamnnort/request
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
## Info
Request handler for Node.js - Fast - Interactive - Simple
## Installation
```bash
yarn install @iamnnort/request
```## Usage
```javascript
import { RequestDataSource, HttpMethods } from '@iamnnort/request';const dataSource = new RequestDataSource({
baseUrl: '...',
url: '/users'
});const users = await dataSource.search();
const user = await dataSource.get();
```## Parameters
| Parameter | Description |
| ------------------ | -------------------------------------------------------------------------- |
| `baseUrl` | Main part of the server URL that will be used for the request |
| `url` | Server URL that will be used for the request |
| `urlParts` | Additional parts of URL that will be used for the request |
| `method` | Request method to be used when making the request |
| `params` | URL parameters to be sent with the request |
| `data` | Data to be sent as the request body |
| `headers` | Custom headers to be sent |
| `serializer` | Config that allows you to customize serializing |
| `serializer.array` | Array element separator (`"indices"`, `"brackets"`, `"repeat"`, `"comma"`) |
| `logger` | Enable a logger |
| `debug` | Enable a debug mode |## License
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.