Skip to content

Commit 2c0af37

Browse files
JeremyPleasedrew-gross
authored andcommitted
Update README.md with express middleware instructions (#312)
1 parent 4586449 commit 2c0af37

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Parse Dashboard is a standalone dashboard for managing your Parse apps. You can
1010
* [Configuring Parse Dashboard](#configuring-parse-dashboard)
1111
* [Managing Multiple Apps](#managing-multiple-apps)
1212
* [Other Configuration Options](#other-configuration-options)
13+
* [Running as Express Middleware](#running-as-express-middleware)
1314
* [Deploying Parse Dashboard](#deploying-parse-dashboard)
1415
* [Preparing for Deployment](#preparing-for-deployment)
1516
* [Security Considerations](#security-considerations)
@@ -113,6 +114,61 @@ You can set `appNameForURL` in the config file for each app to control the url o
113114

114115
To change the app to production, simply set `production` to `true` in your config file. The default value is false if not specified.
115116

117+
# Running as Express Middleware
118+
119+
Instead of starting Parse Dashboard with the CLI, you can also run it as an [express](https://github.com/expressjs/express) middleware.
120+
121+
```
122+
var express = require('express');
123+
var ParseDashboard = require('parse-dashboard');
124+
125+
var dashboard = new ParseDashboard({
126+
"apps": [
127+
{
128+
"serverURL": "http://localhost:1337/parse",
129+
"appId": "myAppId",
130+
"masterKey": "myMasterKey",
131+
"appName": "MyApp"
132+
}
133+
]
134+
});
135+
136+
var app = express();
137+
138+
// make the Parse Dashboard available at /dashboard
139+
app.use('/dashboard', dashboard);
140+
141+
var httpServer = require('http').createServer(app);
142+
httpServer.listen(4040);
143+
```
144+
145+
If you want to run both [Parse Server](https://github.com/ParsePlatform/parse-server) and Parse Dashboard on the same server/port, you can run them both as express middleware:
146+
147+
```
148+
var express = require('express');
149+
var ParseServer = require('parse-server').ParseServer;
150+
var ParseDashboard = require('parse-dashboard');
151+
152+
var api = new ParseServer({
153+
// Parse Server settings
154+
});
155+
156+
var dashboard = new ParseDashboard({
157+
// Parse Dashboard settings
158+
});
159+
160+
var app = express();
161+
162+
// make the Parse Server available at /parse
163+
app.use('/parse', api);
164+
165+
// make the Parse Dashboard available at /dashboard
166+
app.use('/dashboard', dashboard);
167+
168+
var httpServer = require('http').createServer(app);
169+
httpServer.listen(4040);
170+
```
171+
116172
# Deploying Parse Dashboard
117173

118174
## Preparing for Deployment

0 commit comments

Comments
 (0)