Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dreaming-codes/axios-tauri-http-adapter
https://github.com/dreaming-codes/axios-tauri-http-adapter
adapter axios axios-adapter http tauri typescript
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dreaming-codes/axios-tauri-http-adapter
- Owner: Dreaming-Codes
- License: mit
- Created: 2023-10-15T15:28:00.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-08T01:22:57.000Z (11 months ago)
- Last Synced: 2024-10-11T19:35:49.467Z (3 months ago)
- Topics: adapter, axios, axios-adapter, http, tauri, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/axios-tauri-http-adapter
- Size: 92.8 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# axios-tauri-http-adapter
This is an adapter for the tauri plugin http v2. This requires tauri 2.
To install this adapter, run:
```bash
# with pnpm
pnpm install axios-tauri-http-adapter
# with npm
npm install axios-tauri-http-adapter
# with yarn
yarn add axios-tauri-http-adapter
# with bun
bun add axios-tauri-http-adapter
```Then add the official plugin to your cargo dependencies:
```toml
# src-tauri/Cargo.toml
[dependencies]
# ...
tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```Then add the plugin to your tauri config:
```json5
// src-tauri/tauri.conf.json
{
// ...
"plugins": {
"http": {
// Customize the scope as needed, this will allow all http requests
"scope": [
"http://**",
"https://**"
]
}
}
}
```Then initialize the plugin in your tauri app:
```rust
// src-tauri/src/lib.rs or src-tauri/src/main.rs (it may differ depending on how you set up your tauri app)
pub fn run() {
tauri::Builder::default()
// ...
.plugin(tauri_plugin_http::init())
// ...
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```Then add the adapter to your axios instance:
```js
import axiosAdapter from "axios-tauri-http-adapter";const axiosClient = axios.create({
adapter: axiosAdapter()
})
```Enjoy blazingly fast http requests in your tauri app with axios without having to worry about CORS and other browser limitations.