loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5355542352503873","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgQXBwYmFzZSA9IHJlcXVpcmUoImFwcGJhc2UtanMiKTsKCi8vIENyZWF0ZSBhcHBiYXNlIGluc3RhbmNlIHRvIHVzZSBtZXRob2RzCmNvbnN0IGFwcGJhc2VSZWYgPSBBcHBiYXNlKHsKICB1cmw6ICJodHRwczovL3NjYWxyLmFwaS5hcHBiYXNlLmlvIiwKICBhcHA6ICJob3VzaW5nLWRlbW8iLAogIGNyZWRlbnRpYWxzOiAiWW5DZ1Z3b3pWOmU5ZWM1Y2IwLTU4ZDgtNGJiMC1iYWRjLWFjYWY3MjY2NjFmMSIKfSk7CgovLyBTdWJzY3JpYmUgdG8gc3RyZWFtaW5nIGRhdGEgYnkgYSBxdWVyeQphcHBiYXNlUmVmLnNlYXJjaFN0cmVhbSh7CiAgdHlwZTogImxpc3RpbmciLAogIGJvZHk6IHsKICAgIHF1ZXJ5OiB7CiAgICAgIG1hdGNoX2FsbDoge30KICAgIH0KICB9Cn0sCiAgZGF0YSA9PiB7CiAgICBjb25zb2xlLmxvZyhkYXRhKTsKICB9LAogIGVycm9yID0+IHsKICAgIGNvbnNvbGUubG9nKCJjYXVnaHQgYSBzdHJlYW0gZXJyb3IiLCBlcnJvcik7CiAgfSkKCi8vIE5ldyBob3VzZSBkYXRhIG9iamVjdApjb25zdCBqc29uT2JqZWN0ID0gewogIG5hbWU6ICdUaGUgRGFuayBIb3VzZScsCiAgcm9vbV90eXBlOiAnUHJpdmF0ZSByb29tJywKICBwcm9wZXJ0eV90eXBlOiAnVG93bmhvdXNlJywKICBwcmljZTogMTI0LAogIGhhc19hdmFpbGFiaWxpdHk6IHRydWUsCiAgYWNjb21tb2RhdGVzOiAyLAogIGJlZHJvb21zOiAxLAogIGJhdGhyb29tczogMS41LAogIGJlZHM6IDEsCiAgYmVkX3R5cGU6ICdSZW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15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const Appbase = require("appbase-js");

// Create appbase instance to use methods
const appbaseRef = Appbase({
  url: "https://scalr.api.appbase.io",
  app: "housing-demo",
  credentials: "YnCgVwozV:e9ec5cb0-58d8-4bb0-badc-acaf726661f1"
});

// Subscribe to streaming data by a query
appbaseRef.searchStream({
  type: "listing",
  body: {
    query: {
      match_all: {}
    }
  }
},
  data => {
    console.log(data);
  },
  error => {
    console.log("caught a stream error", error);
  })

// New house data object
const jsonObject = {
  name: 'The Dank House',
  room_type: 'Private room',
  property_type: 'Townhouse',
  price: 124,
  has_availability: true,
  accommodates: 2,
  bedrooms: 1,
  bathrooms: 1.5,
  beds: 1,
  bed_type: 'Real Bed',
  host_image: 'https://a2.muscache.com/ac/pictures/7c28a155-3eb8-438d-8f51-426b191ab795.jpg?interpolation=lanczos-none&crop=w:w;*,*&crop=h:h;*,*&resize=50:*&output-format=jpg&output-quality=70',
  host_name: 'Alyson',
  image: 'https://a0.muscache.com/im/pictures/68837752/96cae4d1_original.jpg?aki_policy=medium',
  listing_url: 'https://www.airbnb.com/rooms/5364119',
  location: {
    lat: 47.53540733743967,
    lon: -122.27983057017123
  },
  date_from: 20170426,
  date_to: 20170421,
};

// Insert house data with index method
setTimeout(() => {
  appbaseRef.index({
    type: "listing",
    id: "H1",
    body: jsonObject
  }).then(response => {
    console.log("Success: ", response);
  }).catch(error => {
    console.log("Error: ", error);
  });
}, 200);
node v10.16.0