Adds standalone parse server, configurable by environment, and that can start with npm start
This commit is contained in:
43
bin/parse-server
Executable file
43
bin/parse-server
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
var express = require('express');
|
||||
var ParseServer = require("../index").ParseServer;
|
||||
|
||||
var app = express();
|
||||
|
||||
var options = {};
|
||||
if (process.env.PARSE_SERVER_OPTIONS) {
|
||||
|
||||
options = JSON.parse(process.env.PARSE_SERVER_OPTIONS);
|
||||
|
||||
} else {
|
||||
|
||||
options.databaseURI = process.env.PARSE_SERVER_DATABASE_URI;
|
||||
options.cloud = process.env.PARSE_SERVER_CLOUD_CODE_MAIN;
|
||||
options.collectionPrefix = process.env.PARSE_SERVER_COLLECTION_PREFIX;
|
||||
|
||||
// Keys and App ID
|
||||
options.appId = process.env.PARSE_SERVER_APPLICATION_ID;
|
||||
options.clientKey = process.env.PARSE_SERVER_CLIENT_KEY;
|
||||
options.restAPIKey = process.env.PARSE_SERVER_REST_API_KEY;
|
||||
options.dotNetKey = process.env.PARSE_SERVER_DOTNET_KEY;
|
||||
options.javascriptKey = process.env.PARSE_SERVER_JAVASCRIPT_KEY;
|
||||
options.dotNetKey = process.env.PARSE_SERVER_DOTNET_KEY;
|
||||
options.masterKey = process.env.PARSE_SERVER_MASTER_KEY;
|
||||
options.fileKey = process.env.PARSE_SERVER_FILE_KEY;
|
||||
// Comma separated list of facebook app ids
|
||||
var facebookAppIds = process.env.PARSE_SERVER_FACEBOOK_APP_IDS;
|
||||
|
||||
if (facebookAppIds) {
|
||||
facebookAppIds = facebookAppIds.split(",");
|
||||
options.facebookAppIds = facebookAppIds;
|
||||
}
|
||||
}
|
||||
|
||||
var mountPath = process.env.PARSE_SERVER_MOUNT_PATH || "/";
|
||||
var api = new ParseServer(options);
|
||||
app.use('/', api);
|
||||
|
||||
var port = process.env.PORT || 1337;
|
||||
app.listen(port, function() {
|
||||
console.log('parse-server-example running on http://localhost:'+ port + mountPath);
|
||||
});
|
||||
Reference in New Issue
Block a user