Adonis AlgoliaSearch
This package is a wrapper on top of algoliasearch-client-javascript.
Getting Started
Install the package using the adonis
CLI.
> adonis install adonis-algoliasearch
Follow instructions that are displayed (or read them here).
Configure
Register the provider in start/app.js
:
const providers = [
...
'adonis-algoliasearch/providers/AlgoliaSearchProvider'
]
Add a configuration file in config/algolia.js
. For example:
'use strict'
const Env = use('Env')
module.exports = {
id: Env.get('ALGOLIA_APP_ID'),
index: Env.get('ALGOLIA_APP_INDEX'),
apiKey: Env.get('ALGOLIA_API_KEY')
}
Usage
const AlgoliaSearch = use('AlgoliaSearch')
const index = AlgoliaSearch.index('projects')
The index returned is the client.initIndex
of algoliasearch
, you have then access to all methods.
Thanks
Special thanks to the creator(s) of AdonisJS for creating such a great framework.
License
MIT