Merge pull request #225 from flovilmart/standalone-server
Adds standalone parse server
This commit is contained in:
36
README.md
36
README.md
@@ -74,6 +74,42 @@ app.listen(port, function() {
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Standalone usage
|
||||||
|
|
||||||
|
You can configure the Parse Server with environment variables:
|
||||||
|
|
||||||
|
```js
|
||||||
|
PARSE_SERVER_DATABASE_URI
|
||||||
|
PARSE_SERVER_CLOUD_CODE_MAIN
|
||||||
|
PARSE_SERVER_COLLECTION_PREFIX
|
||||||
|
PARSE_SERVER_APPLICATION_ID // required
|
||||||
|
PARSE_SERVER_CLIENT_KEY
|
||||||
|
PARSE_SERVER_REST_API_KEY
|
||||||
|
PARSE_SERVER_DOTNET_KEY
|
||||||
|
PARSE_SERVER_JAVASCRIPT_KEY
|
||||||
|
PARSE_SERVER_DOTNET_KEY
|
||||||
|
PARSE_SERVER_MASTER_KEY // required
|
||||||
|
PARSE_SERVER_FILE_KEY
|
||||||
|
PARSE_SERVER_FACEBOOK_APP_IDS // string of comma separated list
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Alernatively, you can use the `PARSE_SERVER_OPTIONS` environment variable set to the JSON of your configuration (see Usage).
|
||||||
|
|
||||||
|
To start the server, just run `npm start`.
|
||||||
|
|
||||||
|
##### Global installation
|
||||||
|
|
||||||
|
You can install parse-server globally
|
||||||
|
|
||||||
|
`$ npm install -g parse-server`
|
||||||
|
|
||||||
|
Now you can just run `$ parse-server` from your command line.
|
||||||
|
|
||||||
|
|
||||||
### Supported
|
### Supported
|
||||||
|
|
||||||
* CRUD operations
|
* CRUD operations
|
||||||
|
|||||||
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);
|
||||||
|
});
|
||||||
@@ -31,9 +31,13 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"pretest": "MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} mongodb-runner start",
|
"pretest": "MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} mongodb-runner start",
|
||||||
"test": "TESTING=1 ./node_modules/.bin/istanbul cover --include-all-sources -x **/spec/** ./node_modules/.bin/jasmine",
|
"test": "TESTING=1 ./node_modules/.bin/istanbul cover --include-all-sources -x **/spec/** ./node_modules/.bin/jasmine",
|
||||||
"posttest": "mongodb-runner stop"
|
"posttest": "mongodb-runner stop",
|
||||||
|
"start": "./bin/parse-server"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.1"
|
"node": ">=4.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"parse-server": "./bin/parse-server"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user