mirror of
https://github.com/zhigang1992/uber-cities.git
synced 2026-04-05 09:40:03 +08:00
16 lines
397 B
JavaScript
16 lines
397 B
JavaScript
require('dotenv').config()
|
|
let algoliasearch = require('algoliasearch')
|
|
const data = require('./utils/combine-files')
|
|
|
|
let client = algoliasearch('UEHWANDHH2', process.env.ALGOLIA_KEY)
|
|
let index = client.initIndex('cities')
|
|
|
|
index.clearIndex(function(err, content) {
|
|
if (err) throw err
|
|
|
|
index.addObjects(data, (err, content) => {
|
|
if (err) console.log(err)
|
|
console.log(content)
|
|
})
|
|
})
|