Sha256: 138e9bf5d167beb334ddd8788a84e5a16d16b2ce1d2897c55cf192f143200637

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

const algoliasearch = require('algoliasearch')
const alg = algoliasearch(
  process.env.ALGOLIA_APP_ID,
  process.env.ALGOLIA_SEARCH_API_KEY, {
    timeout: 4000
  }
)
const client = alg.initIndex('mathieu-meyer-dev')

module.exports = {

  home: function(cb){
    client.search({
      query: '',
      filters: `item_type:post`,
      hitsPerPage: 100
    }).then( (content,err) => {
      return cb(content.hits)
    })
  },
  
  show: function(slug,cb){
    client.search({
      query: '',
      filters: `item_type:post`,
      hitsPerPage: 1
    }).then( (content,err) => {
      return cb(content.hits[0])
    })
  }
  
}

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
dx-0.1.0 docs/queries.js
dx-0.1.0 lib/templates/pug/queries.js