Giter Site home page Giter Site logo

relative uri about typesense-js HOT 4 OPEN

typesense avatar typesense commented on June 15, 2024
relative uri

from typesense-js.

Comments (4)

kishorenc avatar kishorenc commented on June 15, 2024

In order to keep the clients uniform, we will probably not be able to do this. But, here's a easy way to get the host: instead of parsingwindow.location properties individually and stringing them together, you can simply use window.location.origin to get the fully qualified host name in a format like this:

https://github.com

from typesense-js.

dpastoor avatar dpastoor commented on June 15, 2024

Yes, I understand these things are possible, its just not really idiomatic for javascript clients

For example the documentation for axios (and just about every other api example for any client library) shows client examples like so:

// Send a POST request
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
});

whereas we now need to

`${window.location.origin}/${apiPrefix}`

from typesense-js.

mkbrechtel avatar mkbrechtel commented on June 15, 2024

I would like to run the frontend for the typesense server on the same host as the server. It would be nice if it would be possible to not set the host in the config or have an option to let the client use a relative path. Could you please open the ticket again, this is something that is usually possible with most API clients.

This would simplify the build process when a frontend is used on multiple domains, so the frontend can be generically build.

from typesense-js.

jasonbosco avatar jasonbosco commented on June 15, 2024

@mkbrechtel I started making the changes needed to support your ask, but then I noticed (and remembered) that we already support this.

If you set node.url to / or ``, that should do what you're looking for.

from typesense-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.