Need help datasource #64
-
|
Hi I really like this project the only thing that I would like its data source there it no datasource to select from queries like httprequest...etc how can I add the http? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
Hello @wolfayoub2023, according to the docs, the developer decided to leave the queries module out since we can use the PocketBase extend with JS features and a TanStack query client instance. Just access your secret data sources from the PocketBase extended routes, and public data sources from the front end using TanStack Query. |
Beta Was this translation helpful? Give feedback.
-
|
You can use the pocketbase sdk to make a request to a custom endpoint in your pocketbase instance: //Use this in a JS Query
window.pb.send('/custom-pocketbase-route-path/some-path-param', fetchOptions = {})//pb_hooks/main.pb.js
routerAdd("GET", "custom-pocketbase-route-path/:pathParamName", (c) => {
let name = c.pathParam("pathParamName")
const res = $http.send({
url: `http://some-external-endpoint.com/${name}`,
method: "GET",
body: "", // ex. JSON.stringify({"test": 123}) or new FormData()
headers: {}, // ex. {"content-type": "application/json"}
timeout: 120, // in seconds
})
return c.json(200, res.json)
}, /* optional middlewares */) |
Beta Was this translation helpful? Give feedback.
You can use the pocketbase sdk to make a request to a custom endpoint in your pocketbase instance:
I…