亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

parse-server和parse-dashboard安裝及阿里云express部署

pcChao / 2175人閱讀

摘要:一參考資源網(wǎng)址官網(wǎng)資源站資源站頁國內(nèi)用戶文章二開始部署基礎(chǔ)環(huán)境安裝等。安裝官網(wǎng)下載安裝即可。到安裝目的的文件夾運(yùn)行啟動(dòng)服務(wù)。修改結(jié)果如下說明是的數(shù)據(jù)庫地址,請(qǐng)確保該地址正確。解決辦法是將導(dǎo)入的數(shù)據(jù)重新導(dǎo)出或,將會(huì)獲得包含的數(shù)據(jù)。

一、參考資源網(wǎng)址
1、http://parseplatform.org/#server 官網(wǎng)
2、https://github.com/parse-comm... github資源站
3、https://github.com/parse-comm... github資源站
4、http://docs.parseplatform.org... parse-server guide頁
5、http://www.shirlman.com/tec/2... 國內(nèi)用戶文章

二、開始部署
1、基礎(chǔ)環(huán)境:安裝git nodejs express 等。
2、安裝MongoDB:官網(wǎng)下載安裝即可。
3、啟動(dòng)MongoDB:啟動(dòng)cmd,運(yùn)行下面命令。
(1) cd到安裝目的的bin文件夾 C:Program FilesMongoDBServer3.4bin
(2) 運(yùn)行mongod 啟動(dòng)服務(wù)。--dbpath為數(shù)據(jù)庫路徑,需要事先創(chuàng)建路徑"C:ForgeMongoDbdb"。

$ cd C:Program FilesMongoDBServer3.4in
$ mongod   --dbpath=C:ForgeMongoDbdb

注:啟動(dòng)服務(wù)也可以直接在cmd中執(zhí)行下面命令:

 $ "C:Program FilesMongoDBServer3.4inmongod.exe"   --dbpath=C:ForgeMongoDbdb

4、安裝parser-server:

  $ npm install -g parse-server mongodb-runner

5、安裝Parse-Dashboard

$ npm install -g parse-dashboard

至此,parse-server和dashboard都已經(jīng)安裝好了,接下來就是如何進(jìn)行配置和在express中啟動(dòng)服務(wù)了。

三、參數(shù)配置及利用express啟動(dòng)parse-server和dashboard服務(wù)
1、安裝parse-server啟動(dòng)樣例,可以從github中下載并在本地解壓:https://github.com/parse-comm...
2、修改index.js文件parse-server-example中只包含了parse-server服務(wù),需要同時(shí)啟動(dòng)dashboard服務(wù)就需要修改index.js文件。修改結(jié)果如下:

// Example express application adding the parse-server module to expose Parse
// compatible API routes.

var express = require("express");
var ParseServer = require("parse-server").ParseServer;
var path = require("path");

var allowInsecureHTTP = true;
var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

if (!databaseUri) {
  console.log("DATABASE_URI not specified, falling back to localhost.");
}

var api = new ParseServer({
  databaseURI: databaseUri || "mongodb://localhost:27017/dev",
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + "/cloud/main.js",
  appId: process.env.APP_ID || "myAppId",
  masterKey: process.env.MASTER_KEY || "myMasterKey", //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || "http://localhost:1337/parse",  // Don"t forget to change to https if needed
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  }
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve static assets from the /public folder
app.use("/public", express.static(path.join(__dirname, "/public")));

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || "/parse";
app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes
app.get("/", function(req, res) {
  res.status(200).send("I dream of being a website.  Please star the parse-server repo on GitHub!");
});

// There will be a test page available on the /test path of your server url
// Remove this before launching your app
app.get("/test", function(req, res) {
  res.sendFile(path.join(__dirname, "/public/test.html"));
});

var port =  1337;
var httpServer = require("http").createServer(app);
httpServer.listen(port, function() {
    console.log("parse-server-example running on port " + port + ".");
});

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);

var ParseDashboard = require("parse-dashboard");

var dashboard = new ParseDashboard({
  apps: [
    {
      appId: process.env.APP_ID || "myAppId",
      masterKey:  "myMasterKey",
      serverURL:  "http://your_ip_address:1337/parse",
      appName: process.env.APP_NAME || "MyApp"
    }
  ],
  users: 
  [
    {
        user:"admin",
        pass:"admin"
    }
  ]
},allowInsecureHTTP);
// make the Parse Dashboard available at /
app.use("/dash", dashboard);

var port2 =  4040;
var httpServer = require("http").createServer(app);
httpServer.listen(port2, function() {
  console.log("parse-dashboard-example running on port " + port2 + ".");
});

說明:
(1)、databaseURI: databaseUri || "mongodb://localhost:27017/dev",
databaseURI是mongoDB的數(shù)據(jù)庫地址,請(qǐng)確保該地址正確。
(2)、參數(shù)allowInsecureHTTP 是為了保證遠(yuǎn)程能夠訪問。
(3)、出現(xiàn)錯(cuò)誤提示Configure a user to access Parse Dashboard remotely說明沒有配置訪問用戶,需要在ParseDashboard中增加下面用戶配置。

  users: 
  [
    {
        user:"admin",
        pass:"admin"
    }
  ]

(4)登錄面板中app無法操作,提示:Server not reachable: unauthorized,這是因?yàn)樵赿ashboard配置中需要把localhost改成你的公網(wǎng)ip,如下
serverURL: "http://your_ip_address:1337/p...",
3、cd 到parse-server-example目錄

$ cd C:ForgeMongoDbparse-server-example-master

4、cmd中輸入如下命令啟動(dòng)parse-server和parse-dashboard

   $ npm start

5、訪問localhost:4040/dash 即可進(jìn)入parse面板 (用戶名;admin 密碼:admin)

四、mongoDB數(shù)據(jù)管理

1、mongochef:https://studio3t.com/download/ 頁面中選擇4.5.5 版本:
3T Mongo Chef Core即可免費(fèi)使用。其他高版本好像要收費(fèi)使用。
2、mongochef 可以遠(yuǎn)程訪問mongoDB數(shù)據(jù),可以導(dǎo)入、導(dǎo)出數(shù)據(jù)。導(dǎo)入數(shù)據(jù)的時(shí)候會(huì)發(fā)現(xiàn)dashboard中沒有變化,這是因?yàn)檫€需要手工維護(hù)_SCHEMA表數(shù)據(jù)。
3、mongochef導(dǎo)入數(shù)據(jù),發(fā)現(xiàn)無法修改,提示object not exist,這是因?yàn)閷?dǎo)入數(shù)據(jù)時(shí)自動(dòng)生成的_id的格式是objectID。parser的格式是string,所以導(dǎo)致parse的無法獲得其objectID。解決辦法是:將導(dǎo)入的數(shù)據(jù)重新導(dǎo)出csv或json,將會(huì)獲得包含——id的數(shù)據(jù)。將數(shù)據(jù)重新導(dǎo)入,導(dǎo)入的時(shí)候在下面選擇_id格式為String即可。

至此,就可以通過postman 盡情測試了。測試可以參考restAPI:http://docs.parseplatform.org...

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://www.ezyhdfw.cn/yun/19076.html

相關(guān)文章

  • Oracle APEX 系列文章2:在阿里上打造屬于你自己的APEX完整開發(fā)環(huán)境 (準(zhǔn)備工作)

    摘要:本系列文章使用的是阿里云的云服務(wù)器,僅僅是因?yàn)樵趪鴥?nèi)用阿里云的人比較多而已。在這里我們采用將單獨(dú)部署到上運(yùn)行的方式完成安裝,這也是比較推薦的方式。 本文是鋼哥的Oracle APEX系列文章中的其中一篇,完整 Oracle APEX 系列文章如下: Oracle APEX 系列文章1:Oracle APEX, 讓你秒變?nèi)珬i_發(fā)的黑科技 Oracle APEX 系列文章2:在阿里云上打...

    MAX_zuo 評(píng)論0 收藏0
  • Oracle APEX 系列文章2:在阿里上打造屬于你自己的APEX完整開發(fā)環(huán)境 (準(zhǔn)備工作)

    摘要:本系列文章使用的是阿里云的云服務(wù)器,僅僅是因?yàn)樵趪鴥?nèi)用阿里云的人比較多而已。在這里我們采用將單獨(dú)部署到上運(yùn)行的方式完成安裝,這也是比較推薦的方式。 本文是鋼哥的Oracle APEX系列文章中的其中一篇,完整 Oracle APEX 系列文章如下: Oracle APEX 系列文章1:Oracle APEX, 讓你秒變?nèi)珬i_發(fā)的黑科技 Oracle APEX 系列文章2:在阿里云上打...

    xioqua 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<