Skip to content

Commit

Permalink
Parse-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
lumandra committed Jan 18, 2018
1 parent a545896 commit 71617ad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
34 changes: 30 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const express = require('express');
const resolve = require('path').resolve;
const ParseServer = require('parse-server').ParseServer;

const ParseDashboard = require('parse-dashboard');

const PORT = process.env.PORT || 1337;
const URL_SERVER = process.env.SERVER_URL || `http://localhost:${PORT}/parse`;
const URL_DB = process.env.DATABASE_URI || process.env.MONGODB_URI || `mongodb://localhost:27017/parse`;
const URL_SITE = process.env.SITE_URL || `http://localhost:9000`;
const APP_ID = process.env.APP_ID || 'SampleAppId';
const MASTER_KEY = process.env.MASTER_KEY || 'SampleMasterKey';

const DASHBOARD_ACTIVATED = process.env.DASHBOARD_ACTIVATED || false
const USER_EMAIL = process.env.USER_EMAIL || 'test'
const USER_PASS = process.env.USER_PASS || '123456'
module.exports['URL_SITE'] = URL_SITE;


Expand Down Expand Up @@ -65,15 +67,39 @@ const parseConfig = {
invalidLink: `${URL_SITE}/invalid-link`
}
};
module.exports.parseConfig = parseConfig;

module.exports.parseConfig = parseConfig;
const api = new ParseServer(parseConfig);

let app = new express();

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

if (DASHBOARD_ACTIVATED) {
const dashboardConfig = {
apps: [
{
serverURL: URL_SERVER,
appId: APP_ID,
masterKey: MASTER_KEY,
appName: "Chisel"
}
],
users: [
{
"user": USER_EMAIL,
"pass": USER_PASS
}
],
"trustProxy": 1,
PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: 1,
allowInsecureHTTP: 1
};
module.exports.dashboardConfig = dashboardConfig;
const dashboard = new ParseDashboard(dashboardConfig, {allowInsecureHTTP: true});
app.use('/dashboard', dashboard)
}

app.listen(PORT, () => {
console.log(`Parse server running on port ${PORT}.`);
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"dependencies": {
"express": "^4.15.4",
"parse-server": "^2.6.2",
"parse-server-mailgun": "^2.4.6"
"parse-server-mailgun": "^2.4.6",
"parse-dashboard": "^1.1.2"
},
"engines": {
"node": "8.x.x",
Expand Down

0 comments on commit 71617ad

Please sign in to comment.