Facebook killed parse last year, but thankfully they Open-Source the parse backend. Initially, the Parse Backend only supported MongoDB database, but later support for Postgres has been added by the contributor from the community.
So using Postgres with Parse Backend is really quite simple, you just have to install the latest version of Parse Backend, and in the databaseURI specify the Postgres connection string.
Here is an example:
var ParseServer = require('parse-server').ParseServer; var api = new ParseServer({ databaseURI: 'postgres://postgres:pass@localhost:5432/parsedev' // Connection string for your Postgres database cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code appId: 'myAppId', masterKey: 'myMasterKey', // Keep this key secret! fileKey: 'optionalFileKey', serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed });
As you can see in the example above we have specified the connection string to connect to the Postgres database.
If you are not familiar with the structure of the connection string, then here is the breakdown.
"postgres://<Postgres Username>:<Postgres Password>@<DB Host>:<Port>/<Database Name>"
If you have any question, please leave the comment below.
Leave a Reply