How to use parse-server - 10 common examples

To help you get started, we’ve selected a few parse-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shiki / kaiseki / test / parse-server / index.js View on Github external
// Example express application adding the parse-server module to expose Parse
// compatible API routes.
'use strict';
const express = require('express');
const ParseServer = require('parse-server').ParseServer;
const config = require('../config.js');
const port = 1337;
const attr = {
    databaseURI: process.env.DB_URI || 'mongodb://localhost:27017/dev',
    appId: config.applicationId,
    masterKey: 'myMasterKey', //Add your master key here. Keep it secret!
    serverURL: 'http://localhost:' + port + config.mountPath,
};
console.log(attr);
var api = new ParseServer(attr);
var app = express();
app.use(config.mountPath, api);
app.post('/shutdown', function (req, res) {
    res.send('bye~\n');
    process.exit(0);
});
var httpServer = require('http').createServer(app);
httpServer.listen(port, function () {
    console.log('running on port ' + port + '.');
    console.log('mount path', config.mountPath, '.');
});
github Fedeorlandau / parse-model-factory / test / lib / index.js View on Github external
const createServer = async () => {
    const app = express();
    const port = 8000;
    const mongoServerInstance = new MongoInMemory(port); // DEFAULT PORT is 27017
    await mongoServerInstance.start();
    const mongouri = mongoServerInstance.getMongouri('myDatabaseName');
    const api = new ParseServer({
      databaseURI: mongouri,
      appId: 'myAppId',
      masterKey: 'myMasterKey',
      javascriptKey: 'javascriptKey',
      fileKey: 'optionalFileKey',
      restAPIKey: 'java',
      serverURL: 'http://localhost:1337/parse',
    });
    app.use('/parse', api);

    app.get('/find', async (req, res) => {
      try {
        const testObjects = await TestObject._find(TestObject._query());

        if (testObjects) {
          res.status(200).send();
github gimdongwoo / docker-parse-mongo / parse-server / index.js View on Github external
var ParseDashboard = require('parse-dashboard');

// express
var app = express();

// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));

// create api server
var PARSE_APP = PARSE_CONFIG.apps[0];
if (!PARSE_APP.databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}

// parse server
var api = new ParseServer({
  databaseURI: PARSE_APP.databaseUri || 'mongodb://localhost:27017/dev',
  cloud: PARSE_APP.cloudCodeMain || __dirname + '/cloud/main.js',
  appId: PARSE_APP.appId || 'myAppId',
  masterKey: PARSE_APP.masterKey || '', //Add your master key here. Keep it secret!
  fileKey: PARSE_APP.fileKey || '', // Add the file key to provide access to files already hosted on Parse
  serverURL: PARSE_APP.localServerURL || PARSE_APP.serverURL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed
  // liveQuery: {
  //   classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  // },
  // push: {
  //   android: { senderId: process.env.GCM_SENDER_ID, apiKey: process.env.GCM_API_KEY },
  //   ios: [
  //     { pfx: __dirname + "/push/aps_development.p12", bundleId: process.env.APP_BUNDLE_ID, production: false },
  //     { pfx: __dirname + "/push/aps_production.p12", bundleId: process.env.APP_BUNDLE_ID, production: true }
  //   ]
  // },
github TGIO / ParseLiveQuery / Server / server.js View on Github external
"serverURL": "http://192.168.0.31:1337/parse",
            "appId": "myAppId",
            "masterKey": "myMasterKey",
            "appName": "MyApp",
            "clientKey": "2ead5328dda34e688816040a0e78948a"
        }
    ]
});

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

var httpServer = require('http').createServer(app);
httpServer.listen(4040);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);

app.listen(1337, function() {
    console.log('parse-server-example running on port 1337.');
});
github PiratesOnlineRewritten / Pirates-Online-Rewritten / parse / index.js View on Github external
app.use(mountPath, api);
console.log('Starting api at prefix:' + mountPath);

// Server the Parse Dashboard on the /admin URL prefix
mountPath = process.env.DASHBOARD_MOUNT || '/admin';
app.use(mountPath, dashboard);
console.log('Starting dashboard at prefix:' + mountPath);

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

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);
github TechnionYP5777 / SmartCity-ParkingManagement / parse-server-example / index.js View on Github external
});

// There will be a test page available on the /test path of your server url
// Remove this before launching your app
app.get('/test', function(req, res) {
  res.sendFile(path.join(__dirname, '/public/test.html'));
});

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

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);
github gimdongwoo / NIPA-Titanium-BoilerPlate-BaaS / parse-server / index.js View on Github external
// Remove this before launching your app
app.get('/test', function(req, res) {
  res.sendFile(path.join(__dirname, '/public/test.html'));
});

// make the Parse Dashboard available at /dashboard
app.use('/dashboard', dashboard);

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

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);
github yongjhih / docker-parse-server / index.js View on Github external
app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
    res.status(200).send('I dream of being a web site.');
});



if(liveQuery) {
  console.log("Starting live query server");
  var httpServer = require('http').createServer(app);
  httpServer.listen(port);
  console.log('plac');
  var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);
} else {
  app.listen(port, function() {
    console.log('docker-parse-server running on ' + serverURL + ' (:' + port + mountPath + ')');
  });
}

// GraphQL
var isSupportGraphQL = process.env.GRAPHQL_SUPPORT;
var schemaURL = process.env.GRAPHQL_SCHEMA || './cloud/graphql/schema.js';

console.log('isSupportGraphQL :', isSupportGraphQL);
console.log('schemaURL :', schemaURL);

if(isSupportGraphQL){
    console.log('Starting GraphQL...');
github andrewimm / parse-lite / integration / server.js View on Github external
var app = express();

// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/integration',
  appId: 'integration',
  masterKey: 'notsosecret',
  serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed
  cloud: __dirname + '/cloud/main.js',
});

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

const TestUtils = require('parse-server').TestUtils;

app.get('/clear', (req, res) => {
  TestUtils.destroyAllDataPermanently().then(() => {
    res.send('{}');
  });
});

app.listen(1337, () => {
  console.log('parse-server running on port 1337.');
});
github LasaleFamine / docker-mongo-parse-server / parse-server / index.js View on Github external
const app = express();

const {
  APP_ID,
  MASTER_KEY,
  GCM_SENDER_ID,
  GCM_API_KEY,
  PFX_PATH_DEV,
  PFX_PASS_DEV,
  PFX_PATH_PROD,
  PFX_PASS_PROD,
  APP_BUNDLE_ID,
  IS_PRODUCTION
} = process.env;

const api = new ParseServer({
  databaseURI: 'mongodb://mongo-parse-server/', // Connection string for your MongoDB database
  appId: APP_ID,
  masterKey: MASTER_KEY,
  fileKey: 'optionalFileKey',
  serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed
  push: {
    android: {
      senderId: GCM_SENDER_ID,
      apiKey: GCM_API_KEY
    },
    ios: [
      {
        pfx: PFX_PATH_DEV, // The filename of private key and certificate in PFX or PKCS12 format from disk
        passphrase: PFX_PASS_DEV, // optional password to your p12
        bundleId: APP_BUNDLE_ID, // The bundle identifier associate with your app
        production: false // Specifies which APNS environment to connect to: Production (if true) or Sandbox