Skip to content

Commit 54f92f6

Browse files
committed
Merge pull request #113 from ParsePlatform/140
Updating to use latest parse-server and parse sdk for Live Query launch
2 parents eadf4b1 + c5240dd commit 54f92f6

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

index.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,41 @@ var api = new ParseServer({
1616
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
1717
appId: process.env.APP_ID || 'myAppId',
1818
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
19-
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse' // Don't forget to change to https if needed
19+
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
20+
liveQuery: {
21+
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
22+
}
2023
});
2124
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
2225
// If you wish you require them, you can set them as options in the initialization above:
2326
// javascriptKey, restAPIKey, dotNetKey, clientKey
2427

2528
var app = express();
2629

27-
// Config static middleware for assets
28-
app.use('/static', express.static(path.join(__dirname, '/public')));
30+
// Serve static assets from the /public folder
31+
app.use('/public', express.static(path.join(__dirname, '/public')));
2932

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

3437
// Parse Server plays nicely with the rest of your web routes
3538
app.get('/', function(req, res) {
36-
res.status(200).send('I dream of being a web site.');
39+
res.status(200).send('Make sure to star the parse-server repo on GitHub!');
3740
});
38-
// If you are migrating a webapp hosted on domain.parseapp.com:
39-
// Remove statement above serving the 200 status (app.get('/ function()});
40-
// Uncomment app.use below and set the absolute path for serving files in the /public dir
41-
// app.use(express.static(__dirname + '/public'));
4241

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

4748
var port = process.env.PORT || 1337;
48-
app.listen(port, function() {
49+
var httpServer = require('http').createServer(app);
50+
httpServer.listen(port, function() {
4951
console.log('parse-server-example running on port ' + port + '.');
5052
});
53+
54+
// This will enable the Live Query real-time server
55+
ParseServer.createLiveQueryServer(httpServer);
56+

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server-example",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "An example Parse API server using the parse-server module",
55
"main": "index.js",
66
"repository": {
@@ -11,8 +11,8 @@
1111
"dependencies": {
1212
"express": "~4.11.x",
1313
"kerberos": "~0.0.x",
14-
"parse": "~1.6.12",
15-
"parse-server": "~2.1.6"
14+
"parse": "~1.8.0",
15+
"parse-server": "~2.2.0"
1616
},
1717
"scripts": {
1818
"start": "node index.js"

0 commit comments

Comments
 (0)