Skip to content

Commit e3c08ff

Browse files
author
Didier Franc
committed
Update index.js
- Use Express to listen() - Add APP_ID & MASTER_KEY to process.env to work OOB with Docker
1 parent 3414558 commit e3c08ff

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
var express = require('express');
55
var ParseServer = require('parse-server').ParseServer;
6-
var http = require('http');
76

87
if (!process.env.DATABASE_URI) {
98
console.log('DATABASE_URI not specified, falling back to localhost.');
@@ -12,8 +11,8 @@ if (!process.env.DATABASE_URI) {
1211
var api = new ParseServer({
1312
databaseURI: process.env.DATABASE_URI || 'mongodb://localhost:27017/dev',
1413
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
15-
appId: 'myAppId',
16-
masterKey: 'myMasterKey'
14+
appId: process.env.APP_ID || 'myAppId',
15+
masterKey: process.env.MASTER_KEY || 'myMasterKey'
1716
});
1817
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
1918
// If you wish you require them, you can set them as options in the initialization above:
@@ -31,7 +30,6 @@ app.get('/', function(req, res) {
3130
});
3231

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

0 commit comments

Comments
 (0)