https://github.com/orinak/koa-elasticsearch
Assign Elasticsearch client to Koa context
https://github.com/orinak/koa-elasticsearch
Last synced: 10 months ago
JSON representation
Assign Elasticsearch client to Koa context
- Host: GitHub
- URL: https://github.com/orinak/koa-elasticsearch
- Owner: orinak
- Created: 2017-10-22T03:25:33.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-22T04:20:16.000Z (about 8 years ago)
- Last Synced: 2025-02-21T15:03:04.481Z (10 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa-elasticsearch
Assign Elasticsearch client to Koa app context
## Install
```sh
npm install koa-elasticsearch
```
## Usage
```js
// const Koa = require('koa')
// const app = new Koa()
const es = require('koa-elasticsearch')
app.use(es())
app.use(async ctx => {
const { client } = ctx
const res = await client
.search({ q: 'exo' })
ctx.body = res.hits
})
```
## License
MIT