-
Notifications
You must be signed in to change notification settings - Fork 91
Getting started does not work #262
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
Comments
How to solve this issueYou are not using an async wrapper. This is an issue related to the correct usage of await. const MeiliSearch = require("meilisearch");
(async () => {
try {
const config = {
host: "http://127.0.0.1:7700"
};
const meili = new MeiliSearch(config);
await meili.createIndex({ uid: 'yourIndexName' })
} catch (e) {
console.log("Meili error: ", e.message);
}
})(); Library improvement idea just on methods like addDocuments or createIndex:By wrapping the entire block of your code inside an async block this issue will be solved. A possible improvement could be handling every method in the library also with a synch version like it's done with Node.js methods like:
|
Thanks a lot for your help @giorat :) It works like that. Yes, doing a sync version is in our to-do list, we haven't put any issue about that yet, but I will do it :) |
We are adding a function that is called as you can see here meilisearch/integration-guides#1 |
I tried:
In
test.js
Then:
I get:
(Same error if I try with
getIndex
)Can we do a getting started directly working for the JS beginners like me? 😇
Version
meilisearch:
v0.9.0
node:
v10.18.1
The text was updated successfully, but these errors were encountered: