Offline-first web HTTP client
npm run dev
npm run build
npm run build-desktop
npm run build-web-standalone
npm install --save-dev electron@latest @electron-forge/cli@latest @electron-forge/maker-deb@latest @electron-forge/maker-rpm@latest @electron-forge/maker-squirrel@latest @electron-forge/maker-zip@latest
npm run start
npm run make
or
npm run publish
After ui is built, go to the ui/assets/index.[hash].js file and add this code at the top of the file:
export async function fetch(input, init) {
const fetch = window.__TAURI__.http.fetch
const params = {
...init,
body: {
type: 'Text',
payload: init.body
}
};
if(params.body.payload instanceof URLSearchParams) {
params.body.payload = params.body.payload.toString()
}
if(init.method === 'GET' || 'body' in init === false || init.body === null) {
delete params.body
}
const res = await fetch(input.toString(), params)
return new Response(JSON.stringify(res.data), res)
}
npm run dev
npm run build
git clone https://github.com/flawiddsouza/Restfox
cd packages/ui
npm i
npm run build-web-standalone
cd ../web-standalone
npm i
npm start
By default npm start will run Restfox at port 4004. You can override the port by passing port like so PORT=5040 npm start
.