Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lambrohan/nestjs-meilisearch
Meilisearch module for nestjs applications.
https://github.com/lambrohan/nestjs-meilisearch
meilisearch nestjs
Last synced: 1 day ago
JSON representation
Meilisearch module for nestjs applications.
- Host: GitHub
- URL: https://github.com/lambrohan/nestjs-meilisearch
- Owner: lambrohan
- License: mit
- Created: 2021-04-26T18:26:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-08T13:38:13.000Z (2 days ago)
- Last Synced: 2025-02-08T14:28:50.525Z (1 day ago)
- Topics: meilisearch, nestjs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/nestjs-meilisearch
- Size: 315 KB
- Stars: 22
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About
This package is a simple wrapper around [meilisearch-js](https://github.com/meilisearch/meilisearch-js).
## Installation
This package requires `meilisearch` dependency to work properly.
```bash
yarn add nestjs-meilisearch meilisearch
```## Getting Started
The simplest way to use `nestjs-meilisearch` is to use `MeiliSearchModule.forRoot` or `MeiliSearchModule.forRootAsync`
```typescript
import { Module } from '@nestjs-common';
import { MeiliSearchModule } from 'nestjs-meilisearch';@Module({
imports: [
MeiliSearchModule.forRoot({
host: 'http://127.0.0.1:7700',
apiKey: 'masterKey',
}),
],// or async
MeiliSearchModule.forRootAsync({
useFactory: () => ({
host: 'http://127.0.0.1:7700',
apiKey: 'masterKey',
}),
}),
})
export class AppModule {}
```use `@InjectMeiliSearch()` decorator in any injectables to get a `MeiliSearch` client inside class
```typescript
import { Injectable } from '@nestjs/common';
import { InjectMeiliSearch } from 'nestjs-meilisearch';
import { MeiliSearch } from 'meilisearch';
@Injectable()
export class TestService {
public constructor(
@InjectMeiliSearch() private readonly meiliSearch: MeiliSearch,
) {}
}
```You can also use `MeiliSearchService` to `add`,`update` and `delete` documents. I'm planning to add further operations to this service.
## License
Distributed under the MIT License. See `LICENSE` for more information.