|
@@ -16,7 +16,10 @@ var api = new ParseServer({
|
|
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
|
|
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
|
|
appId: process.env.APP_ID || 'myAppId',
|
|
appId: process.env.APP_ID || 'myAppId',
|
|
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
|
|
masterKey: process.env.MASTER_KEY || '', //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
|
|
|
|
|
|
+ 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
|
|
// 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:
|
|
// If you wish you require them, you can set them as options in the initialization above:
|
|
@@ -24,8 +27,8 @@ var api = new ParseServer({
|
|
|
|
|
|
var app = express();
|
|
var app = express();
|
|
|
|
|
|
-// Config static middleware for assets
|
|
|
|
-app.use('/static', express.static(path.join(__dirname, '/public')));
|
|
|
|
|
|
+// 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
|
|
// Serve the Parse API on the /parse URL prefix
|
|
var mountPath = process.env.PARSE_MOUNT || '/parse';
|
|
var mountPath = process.env.PARSE_MOUNT || '/parse';
|
|
@@ -33,18 +36,21 @@ app.use(mountPath, api);
|
|
|
|
|
|
// Parse Server plays nicely with the rest of your web routes
|
|
// Parse Server plays nicely with the rest of your web routes
|
|
app.get('/', function(req, res) {
|
|
app.get('/', function(req, res) {
|
|
- res.status(200).send('I dream of being a web site.');
|
|
|
|
|
|
+ res.status(200).send('Make sure to star the parse-server repo on GitHub!');
|
|
});
|
|
});
|
|
- // If you are migrating a webapp hosted on domain.parseapp.com:
|
|
|
|
- // Remove statement above serving the 200 status (app.get('/ function()});
|
|
|
|
- // Uncomment app.use below and set the absolute path for serving files in the /public dir
|
|
|
|
- // app.use(express.static(__dirname + '/public'));
|
|
|
|
|
|
|
|
|
|
+// 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) {
|
|
app.get('/test', function(req, res) {
|
|
res.sendFile(path.join(__dirname, '/public/test.html'));
|
|
res.sendFile(path.join(__dirname, '/public/test.html'));
|
|
});
|
|
});
|
|
|
|
|
|
var port = process.env.PORT || 1337;
|
|
var port = process.env.PORT || 1337;
|
|
-app.listen(port, function() {
|
|
|
|
|
|
+var httpServer = require('http').createServer(app);
|
|
|
|
+httpServer.listen(port, function() {
|
|
console.log('parse-server-example running on port ' + port + '.');
|
|
console.log('parse-server-example running on port ' + port + '.');
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+// This will enable the Live Query real-time server
|
|
|
|
+ParseServer.createLiveQueryServer(httpServer);
|
|
|
|
+
|