F8app: api.parse.com Shutdown How to import data?

Created on 1 Mar 2017  ·  4Comments  ·  Source: fbsamples/f8app

Hi, genius

api.parse.com Shutdown,
⇒ npm run import-data

[email protected] import-data /Users/bruceniu/Documents/GitHub/f8app
babel-node ./scripts/import-data-from-parse.js

Loading Speakers
SyntaxError: Unexpected token P in JSON at position 0
at JSON.parse ()
at /Users/bruceniu/Documents/GitHub/f8app/node_modules/node-fetch/lib/body.js:43:15
at process._tickDomainCallback (internal/process/next_tick.js:129:7)

code
async function importClass(className) {
console.log('Loading', className);
const response = await fetch(https://api.parse.com/1/classes/${className}, {
method: 'get',
headers: {
'X-Parse-Application-Id': 'R0yDMIKCUyEke2UiadcTBBGd1L5hMBTGJSdBNL3W',
'X-Parse-JavaScript-Key': 'BJ5V0APFMlvmCBPDXl9Mgh3q3dFrs18XkQz6A2bO',
'Content-Type': 'application/json'
},
});
const {results} = await response.json();
const ClassType = Parse.Object.extend(className);
console.log('Cleaning old', className, 'data');
await new Parse.Query(ClassType)
.each(record => record.destroy());
console.log('Converting', className);
return Promise.all(results.map(attrs => importObject(ClassType, attrs)));
}

Thank you very much!

Most helpful comment

I solve this problem by these steps:

  1. download https://github.com/ReactWindows/f8app/blob/data/mongodb/db.zip
  2. install mongoDB by:
    ###### brew install mongodb
  3. start mongoDB server by:
    ###### mongod --dbpath YOURDATAPATH //the path you just downLoaded
  4. start mongoDB client by:
    ###### mongo

Here is an article(in Chinese) you can refer to: http://www.jianshu.com/p/f7cb35436f9a

All 4 comments

I solve this problem by these steps:

  1. download https://github.com/ReactWindows/f8app/blob/data/mongodb/db.zip
  2. install mongoDB by:
    ###### brew install mongodb
  3. start mongoDB server by:
    ###### mongod --dbpath YOURDATAPATH //the path you just downLoaded
  4. start mongoDB client by:
    ###### mongo

Here is an article(in Chinese) you can refer to: http://www.jianshu.com/p/f7cb35436f9a

@liangxiaowei how install db.zip in linux

@hari-mohan-choudhary
Just unzip it.These files are actually a database copy.In my last answer YOURDATAPATH is the path you unzip db.zip.
You can use mongodb to create a database,and then you will get some database files which has fimilar folder structure as db.zip.

thanks @liangxiaowei

Was this page helpful?
0 / 5 - 0 ratings