# parse-server-chat-demo **Repository Path**: layouwen/parse-server-chat-demo ## Basic Information - **Project Name**: parse-server-chat-demo - **Description**: parse-server-chat-demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-20 - **Last Updated**: 2021-10-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # parse-server-example [![Join The Conversation](https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg)](https://community.parseplatform.org/c/parse-server) [![Backers on Open Collective](https://opencollective.com/parse-server/tiers/backers/badge.svg)][open-collective-link] [![Sponsors on Open Collective](https://opencollective.com/parse-server/tiers/sponsors/badge.svg)][open-collective-link] [![License][license-svg]][license-link] [![Twitter Follow](https://img.shields.io/twitter/follow/ParsePlatform.svg?label=Follow%20us%20on%20Twitter&style=social)](https://twitter.com/intent/follow?screen_name=ParsePlatform) Example project using the [parse-server](https://github.com/ParsePlatform/parse-server) module on Express. Read the full [Parse Server Guide](https://docs.parseplatform.org/parse-server/guide/) for more information. # Table of Contents - [Local Development](#local-development) - [Helpful Scripts](#helpful-scripts) - [Remote Deployment](#remote-deployment) - [Heroku](#heroku) - [AWS Elastic Beanstalk](#aws-elastic-beanstalk) - [Microsoft Azure App Service](#microsoft-azure-app-service) - [Google App Engine](#google-app-engine) - [Scalingo](#scalingo) - [OpenShift Online (Next Gen)](#openshift-online-next-gen) - [Using Parse Server](#using-parse-server) - [Health Check](#health-check) - [APIs and SDKs](#apis-and-sdks) - [REST API](#rest-api) - [JavaScript](#javascript) - [Android](#android) - [iOS / tvOS / iPadOS / macOS (Swift)](#ios--tvos--ipados--macos-swift) # Local Development * Make sure you have at least Node 4.3. `node --version` * Clone this repo and change directory to it. * `npm install` * Install mongo locally using http://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x/ * Run `mongo` to connect to your database, just to make sure it's working. Once you see a mongo prompt, exit with Control-D * Run the server with: `npm start` * By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `export PARSE_MOUNT=/1` before launching the server. * You now have a database named "dev" that contains your Parse data * Install ngrok and you can test with devices ## Helpful Scripts These scripts can help you to develop your app for Parse Server: * `npm run watch` will start your Parse Server and restart if you make any changes. * `npm run lint` will check the linting of your cloud code, tests and `index.js`, as defined in `.eslintrc.json`. * `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.js`. * `npm run prettier` will help improve the formatting and layout of your cloud code, tests and `index.js`, as defined in `.prettierrc`. * `npm run test` will run any tests that are written in `/spec`. * `npm run coverage` will run tests and check coverage. Output is available in the `/coverage` folder. # Remote Deployment ## Heroku [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) Alternatively, to deploy manually: * Clone the repo and change directory to it * Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create` * Use the [mLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox --app YourAppName` * By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `heroku config:set PARSE_MOUNT=/1` * Deploy it with: `git push heroku master` ## AWS Elastic Beanstalk Alternatively, deploy your local changes manually: * Clone the repo and change directory to it * Log in with the [AWS Elastic Beanstalk CLI](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html), select a region, and create an app: `eb init` * Create an environment and pass in MongoDB URI, App ID, and Master Key: `eb create --envvars DATABASE_URI=,APP_ID=,MASTER_KEY=` ## Microsoft Azure App Service [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.ParseServer) Detailed information is available here: * [Parse Server with Azure Managed Services](https://azure.microsoft.com/en-us/marketplace/partners/microsoft/parseserver/) * [Parse Server Azure Blog Post](https://azure.microsoft.com/en-us/blog/announcing-the-publication-of-parse-server-with-azure-managed-services/) ## Google App Engine 1. Clone the repo and change directory to it 1. Create a project in the [Google Cloud Platform Console](https://console.cloud.google.com/). 1. [Enable billing](https://console.cloud.google.com/project/_/settings) for your project. 1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/). 1. Setup a MongoDB server. You have a few options: 1. Create a Google Compute Engine virtual machine with [MongoDB pre-installed](https://cloud.google.com/launcher/?q=mongodb). 1. Use [mLab](https://mlab.com/google/) to create a free MongoDB deployment on Google Cloud Platform (only US-central). 1. Modify `app.yaml` to update your environment variables. 1. Delete `Dockerfile` 1. Deploy it with `gcloud preview app deploy` A detailed tutorial is available here: [Running Parse server on Google App Engine](https://cloud.google.com/nodejs/resources/frameworks/parse-server) ## Scalingo [![Deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy) Alternatively, to deploy manually: * Clone the repo and change directory to it * Log in with the [Scalingo CLI](http://cli.scalingo.com/) and create an app: `scalingo create my-parse` * Use the [Scalingo MongoDB addon](https://scalingo.com/addons/scalingo-mongodb): `scalingo addons-add scalingo-mongodb free` * Setup MongoDB connection string: `scalingo env-set DATABASE_URI='$SCALINGO_MONGO_URL'` * By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `scalingo env-set PARSE_MOUNT=/1` * Deploy it with: `git push scalingo master` ## OpenShift Online (Next Gen) 1. Register for a free [OpenShift Online (Next Gen) account](http://www.openshift.com/devpreview/register.html) 1. Create a project in the [OpenShift Online Console](https://console.preview.openshift.com/console/). 1. Install the [OpenShift CLI](https://docs.openshift.com/online/getting_started/beyond_the_basics.html#btb-installing-the-openshift-cli). 1. Add the Parse Server template to your project: `oc create -f https://raw.githubusercontent.com/ParsePlatform/parse-server-example/master/openshift.json` 1. Deploy Parse Server from the web console 1. Open your project in the [OpenShift Online Console](https://console.preview.openshift.com/console/): 1. Click **Add to Project** from the top navigation 1. Scroll down and select **NodeJS > Parse Server** 1. (Optionally) Update the Parse Server settings (parameters) 1. Click **Create** A detailed tutorial is available here: [Running Parse Server on OpenShift Online (Next Gen)](https://blog.openshift.com/parse-server/) # Using Parse Server ## Health Check You can use the `/health` endpoint to verify that Parse Server is up and running. For example, for local deployment, enter this URL in your browser: > [http://localhost:1337/parse/health](http://localhost:1337/parse/health) If you deployed Parse Server remotely, change the URL accordingly. ## APIs and SDKs Use the REST API, GraphQL API or any of the Parse SDKs to see Parse Server in action. Parse Server comes with a variety of SDKs to cover most common ecosystems and languages, such as JavaScript, Swift, ObjectiveC and Android just to name a few. The following shows example requests when interacting with a local deployment of Parse Server. If you deployed Parse Server remotely, change the URL accordingly. ### REST API Save object: ```sh curl -X POST \ -H "X-Parse-Application-Id: YOUR_APP_ID" \ -H "Content-Type: application/json" \ -d '{"score":1337}' \ http://localhost:1337/parse/classes/GameScore ``` Call Cloud Code function: ```sh curl -X POST \ -H "X-Parse-Application-Id: YOUR_APP_ID" \ -H "Content-Type: application/json" \ -d "{}" \ http://localhost:1337/parse/functions/hello ``` ### JavaScript ```js // Initialize SDK Parse.initialize("YOUR_APP_ID", "unused"); Parse.serverURL = 'http://localhost:1337/parse'; // Save object const obj = new Parse.Object('GameScore'); obj.set('score',1337); await obj.save(); // Query object const query = new Parse.Query('GameScore'); const objAgain = await query.get(obj.id); ``` ### Android ```java // Initialize SDK in the application class Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()) .applicationId("YOUR_APP_ID") .server("http://localhost:1337/parse/") // '/' important after 'parse' .build()); // Save object ParseObject obj = new ParseObject("TestObject"); obj.put("foo", "bar"); obj.saveInBackground(); ``` ### iOS / tvOS / iPadOS / macOS (Swift) ```swift // Initialize SDK in AppDelegate Parse.initializeWithConfiguration(ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) -> Void in configuration.server = "http://localhost:1337/parse/" // '/' important after 'parse' configuration.applicationId = "YOUR_APP_ID" })) ``` You can change the server URL in all of the open-source SDKs, but we're releasing new builds which provide initialization time configuration of this property. [license-svg]: https://img.shields.io/badge/license-BSD-lightgrey.svg [license-link]: LICENSE [open-collective-link]: https://opencollective.com/parse-server