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

const app = express();
const api = new ParseServer({
  databaseURI: 'postgresql://fearless:1004@dev.fmode.cn:5432/fearless',
  appId: 'fearless',
  masterKey: 'fearless',
  masterKeyIps: ['0.0.0.0/0','::/0'] ,
  allowClientClassCreation:true,
  allowHeaders:["*"],
  allowOrigin:"*",
});

async function main(){
  await api.start();

  // Serve the Parse API at /parse URL prefix
  app.use('/parse', api.app);

  const port = 1337;
  app.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
  });
}
main();
