Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno Support #1402

Open
takmatsukawa opened this issue Apr 28, 2022 · 2 comments
Open

Deno Support #1402

takmatsukawa opened this issue Apr 28, 2022 · 2 comments

Comments

@takmatsukawa
Copy link

Are there any plans for supporting Deno runtime?

It's already possible to import algoliasearch via esm.sh and skypack, however it seems that using XMLHttpRequest makes it impossible.

Thanks!

@Haroenv
Copy link
Contributor

Haroenv commented Apr 29, 2022

We have not had any requests in the past for Deno support, so have not yet looked into any quick wins. There's a couple options I see:

  1. polyfill XHR: https://deno.land/x/xhr@0.1.0
  2. pass a custom requester when creating the algoliasearch client, which uses fetch

I'd love to hear when you try these options out

@takmatsukawa
Copy link
Author

takmatsukawa commented Apr 29, 2022

Thank you for your quick response!
Maybe the second option is better but the first one worked!

import algoliasearch from 'https://esm.sh/algoliasearch@4.13.0';
import "https://deno.land/x/xhr@0.1.0/mod.ts";

const client = algoliasearch(APP_ID, API_KEY);
const index = client.initIndex('my_index');

index.saveObject(object);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants