Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
- Use Express to listen()
- Add APP_ID & MASTER_KEY to process.env to work OOB with Docker
  • Loading branch information
Didier Franc committed Jan 31, 2016
1 parent 3414558 commit e3c08ff
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var http = require('http');

if (!process.env.DATABASE_URI) {
console.log('DATABASE_URI not specified, falling back to localhost.');
Expand All @@ -12,8 +11,8 @@ if (!process.env.DATABASE_URI) {
var api = new ParseServer({
databaseURI: process.env.DATABASE_URI || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: 'myAppId',
masterKey: 'myMasterKey'
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || 'myMasterKey'
});
// 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:
Expand All @@ -31,7 +30,6 @@ app.get('/', function(req, res) {
});

var port = process.env.PORT || 1337;
var httpServer = http.createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
app.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});

0 comments on commit e3c08ff

Please sign in to comment.