How to use the parse/node.serverURL function in parse

To help you get started, we’ve selected a few parse 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 flow-typed / flow-typed / definitions / npm / parse_v1.9.x / test_parse.v1.9.x.js View on Github external
// @flow
import Parse from 'parse/node'

Parse.initialize('appid');
Parse.initialize('appid', 'jskey');

Parse.masterKey = 'masterkey';
Parse.masterKey = null;
Parse.serverURL = 'http://localhost:8080';

const parseObject = new Parse.Object('Test')
parseObject.get('username');
parseObject.destroy();

class ES6TestObject extends Parse.Object {
  constructor() {
    super("ES6TestObject");
  }
}

Parse.Object.registerSubclass("ES6TestObject", ES6TestObject);

async () => {
  const testObjectQuery = new Parse.Query(ES6TestObject);
  const testObjects: Array = await testObjectQuery.find();
github bakery / pokemon-map / src / parse-server / index.js View on Github external
setup(app, appName, settings) {
    Parse.initialize(settings.parseServerApplicationId, 'js-key', settings.parseServerMasterKey);
    Parse.serverURL = settings.parseServerURL;

    const api = new ParseServer({
      appId: settings.parseServerApplicationId,
      masterKey: settings.parseServerMasterKey,
      serverURL: settings.parseServerURL,
      databaseURI: settings.parseServerDatabaseURI,
    });

    const iconsFolder = process.env.NODE_ENV === 'development' ?
      './server/public/images' : './public/images';

    app.use('/parse', api);

    app.use(
      '/dashboard',
      // eslint-disable-next-line new-cap
github parse-community / parse-server / src / LiveQuery / ParseLiveQueryServer.js View on Github external
this.subscriptions = new Map();

    config.appId = config.appId || Parse.applicationId;
    config.masterKey = config.masterKey || Parse.masterKey;

    // Store keys, convert obj to map
    const keyPairs = config.keyPairs || {};
    this.keyPairs = new Map();
    for (const key of Object.keys(keyPairs)) {
      this.keyPairs.set(key, keyPairs[key]);
    }
    logger.verbose('Support key pairs', this.keyPairs);

    // Initialize Parse
    Parse.Object.disableSingleInstance();
    const serverURL = config.serverURL || Parse.serverURL;
    Parse.serverURL = serverURL;
    Parse.initialize(config.appId, Parse.javaScriptKey, config.masterKey);

    // The cache controller is a proper cache controller
    // with access to User and Roles
    this.cacheController = getCacheController(config);

    // This auth cache stores the promises for each auth resolution.
    // The main benefit is to be able to reuse the same user / session token resolution.
    this.authCache = new LRU({
      max: 500, // 500 concurrent
      maxAge: 60 * 60 * 1000, // 1h
    });
    // Initialize websocket server
    this.parseWebSocketServer = new ParseWebSocketServer(
      server,
github parse-community / parse-server / spec / RevocableSessionsUpgrade.spec.js View on Github external
it('should not upgrade bad legacy session token', done => {
    rp.post({
      url: Parse.serverURL + '/upgradeToRevocableSession',
      headers: {
        'X-Parse-Application-Id': Parse.applicationId,
        'X-Parse-Rest-API-Key': 'rest',
        'X-Parse-Session-Token': 'badSessionToken'
      },
      json: true
    }).then(() => {
      fail('should not be able to upgrade a bad token');
    }, (response) => {
      expect(response.statusCode).toBe(400);
      expect(response.error).not.toBeUndefined();
      expect(response.error.code).toBe(Parse.Error.INVALID_SESSION_TOKEN);
      expect(response.error.error).toEqual('invalid legacy session token');
    }).then(() => {
      done();
    });
github back4app / antframework / packages / ant-util-analytics / lib / Analytics.js View on Github external
initialize(config) {
    assert(config && typeof config === 'object', 'Param "config" is required and must be \
an object');
    this.config = config;
    const { parseAppId, parseJsKey, parseServerUrl, parseStorageFilePath, sentryDsn } = config;

    if (parseAppId && parseJsKey && parseServerUrl && parseStorageFilePath) {
      Parse.initialize(parseAppId, parseJsKey);
      Parse.serverURL = parseServerUrl;
      Parse.CoreManager.setStorageController(new AntStorageController(parseStorageFilePath));
      this.parseInitialized = true;
    }

    if (sentryDsn) {
      Sentry.init({
        dsn: sentryDsn
      });
      this.sentryInitialized = true;
    }
  }
github parse-community / parse-server / spec / RevocableSessionsUpgrade.spec.js View on Github external
it('should not crash without session token #2720', done => {
    rp.post({
      url: Parse.serverURL + '/upgradeToRevocableSession',
      headers: {
        'X-Parse-Application-Id': Parse.applicationId,
        'X-Parse-Rest-API-Key': 'rest'
      },
      json: true
    }).then(() => {
      fail('should not be able to upgrade a bad token');
    }, (response) => {
      expect(response.statusCode).toBe(404);
      expect(response.error).not.toBeUndefined();
      expect(response.error.code).toBe(Parse.Error.OBJECT_NOT_FOUND);
      expect(response.error.error).toEqual('invalid session');
    }).then(() => {
      done();
    });
  });
github parse-community / parse-server / spec / ParseQuery.spec.js View on Github external
query.find().then(function(results) {
        equal(results.length, 1);
        const parentAgain = results[0];
        const goodURL = Parse.serverURL;
        Parse.serverURL = "YAAAAAAAAARRRRRGGGGGGGGG";
        const childAgain = parentAgain.get("child");
        ok(childAgain);
        equal(childAgain.get("foo"), "bar");
        Parse.serverURL = goodURL;
        done();
      });
    });
github parse-community / parse-server / spec / ParseQuery.spec.js View on Github external
Parse.Object.saveAll(objectList).then((results) => {
      equal(objectList.length, results.length);

      return require('request-promise').get({
        url: Parse.serverURL + "/classes/Object",
        json: {
          where: {
            strings: {
              $all: [
                {$regex: '\^\\Qthe\\E'},
                {$regex: '\^\\Qfox\\E'},
                {$regex: '\^\\Qlazy\\E'}
              ]
            }
          }
        },
        headers: {
          'X-Parse-Application-Id': Parse.applicationId,
          'X-Parse-Javascript-Key': Parse.javaScriptKey
        }
      })
github parse-community / parse-server / spec / ParseLiveQueryServer.spec.js View on Github external
return new Promise((resolve, reject) => {
        op(
          {
            url: Parse.serverURL + '/schemas/' + className,
            headers: {
              'X-Parse-Application-Id': Parse.applicationId,
              'X-Parse-Master-Key': Parse.masterKey,
            },
            json: true,
            body: {
              classLevelPermissions: permissions,
            },
          },
          (error, response, body) => {
            if (error) {
              return reject(error);
            }
            if (body.error) {
              return reject(body);
            }
github parse-community / parse-server / spec / helper.js View on Github external
.then(() => {
      Parse.initialize('test', 'test', 'test');
      Parse.serverURL = 'http://localhost:' + port + '/1';
      done();
    })
    .catch(done.fail);