Advertisement
framp

parse server + parse dashboard

Aug 2nd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict"
  2.  
  3. const path = require("path")
  4. const express = require("express")
  5. const ParseServer = require("parse-server").ParseServer
  6. const ParseDashboard = require('parse-dashboard')
  7.  
  8. const app = express()
  9. const port = process.env.PORT || 8080
  10. const appConfig = {
  11.   appId: process.env.PARSE_APP_ID || "",
  12.   serverURL: process.env.PARSE_SERVER_URL || "http://localhost:" + port + "/parse",
  13.   masterKey: process.env.PARSE_MASTER_KEY || "",
  14.   fileKey: process.env.PARSE_FILE_KEY || "",
  15.   appName: "NattrServer"
  16. }
  17.  
  18. const dashboardMount = "/"
  19. const dashboard = new ParseDashboard({
  20.   apps: [ appConfig ],
  21.   users: [ {
  22.     user: process.env.PARSE_ADMIN_USERNAME || "admin",
  23.     pass: process.env.PARSE_ADMIN_PASSWORD || "648961a80a2d"
  24.   } ]
  25. }, true)
  26.  
  27. const api = new ParseServer(Object.assign({
  28.   databaseURI: process.env.PARSE_DATABASE_URI || "mongodb://localhost:27017/dev",
  29.   cloud: path.join(__dirname, "cloud/main.js"),
  30. }, appConfig))
  31. app.use(process.env.PARSE_MOUNT || "/parse", api)
  32. app.use(dashboardMount, dashboard);
  33.  
  34. app.listen(port, function() {
  35.   console.log("parse-server-example running on port " + port)
  36. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement