Skip to content
Discussion options

You must be logged in to vote

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 */)

I…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@wolfayoub2023
Comment options

@pedrozadotdev
Comment options

@ElierHG
Comment options

ElierHG Feb 17, 2025
Collaborator

Comment options

You must be logged in to vote
4 replies
@wolfayoub2023
Comment options

@pedrozadotdev
Comment options

@wolfayoub2023
Comment options

@pedrozadotdev
Comment options

Answer selected by wolfayoub2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants