熟练搭建parse

2018-12-31  本文已影响4人  于桓

安装nodejs

sudo apt-get install nodejs
需要安装8.x以上的版本

安装MongoDB

安装mongodb
mkdir -p ~/mongo ~/mongo/db
cd ./mongo/
docker run -p 27017:27017 -v ~/mongo/db:/data/db -d mongo

克隆parse-server-example

git clone https://github.com/ParsePlatform/parse-server-example.git

parse-server-example

cd ~/parse-server-example
npm install

#vim index.js
var api = new ParseServer({
  databaseURI:  'mongodb://127.0.0.1:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId:  'App_ID',//加上自己的id
  masterKey:  'Master_Key', //Add your master key here. Keep it secret!加上自己的key
  serverURL: process.env.SERVER_URL || 'http://0.0.0.0:1337/parse',  // Don't forget to change to https if needed
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  }
});

安装dashboard

npm install -g parse-dashboard

写一个配置文件

新建配置文件为dashboard-config.jsons

{
  "apps": [
    {
      "serverURL": "http://SERVER_IP:1337/parse",
      "appId": "App_ID",
      "masterKey": "Master_Key",
      "appName": "App_Name"
    }
  ],
  "users": [
      {
           "user":"username",
           "pass":"password"
      }
  ]
}

运行parse-dashboard

parse-dashboard --config dashboard-config.jsons --allowInsecureHTTP

上一篇下一篇

猜你喜欢

热点阅读