Skip to content

Commit f038ca0

Browse files
committed
docs: improve README
1 parent f416c89 commit f038ca0

1 file changed

Lines changed: 2 additions & 253 deletions

File tree

README.md

Lines changed: 2 additions & 253 deletions
Original file line numberDiff line numberDiff line change
@@ -1,255 +1,4 @@
1-
![parse-repository-header](https://user-images.githubusercontent.com/5673677/169108275-8efa0dae-4997-4ddc-9c12-88a9c4c42e31.png)
1+
![parse-repository-header](https://user-image
22

33
---
4-
5-
[![Build Status](https://github.com/parse-community/parse-server-example/workflows/ci/badge.svg?branch=master)](https://github.com/parse-community/parse-server-example/actions?query=workflow%3Aci+branch%3Amaster)
6-
[![Snyk Badge](https://snyk.io/test/github/parse-community/parse-server-example/badge.svg)](https://snyk.io/test/github/parse-community/parse-server-example)
7-
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-server-example/releases)
8-
9-
[![Join The Conversation](https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg)](https://community.parseplatform.org/c/parse-server)
10-
[![Backers on Open Collective](https://opencollective.com/parse-server/backers/badge.svg)][open-collective-link]
11-
[![Sponsors on Open Collective](https://opencollective.com/parse-server/sponsors/badge.svg)][open-collective-link]
12-
[![License][license-svg]][license-link]
13-
[![Forum](https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg)](https://community.parseplatform.org/c/parse-server)
14-
[![Twitter](https://img.shields.io/twitter/follow/ParsePlatform.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=ParsePlatform)
15-
16-
---
17-
18-
This is an example project using the [Parse Server](https://github.com/ParsePlatform/parse-server) module on Express.
19-
20-
21-
The [Parse Server guide](https://docs.parseplatform.org/parse-server/guide/) is a good place to get started. An [API reference](https://parseplatform.org/parse-server/api/) and [Cloud Code guide](https://docs.parseplatform.org/cloudcode/guide/) are also available. If you're interested in developing for Parse Server, the [Development guide](https://docs.parseplatform.org/parse-server/guide/#development-guide) will help you get set up. All documentations for Parse Platform's server and its client SDKs are available at [parseplatform.org](https://parseplatform.org).
22-
23-
---
24-
25-
- [Local Development](#local-development)
26-
- [Docker Deployment](#docker-deployment)
27-
- [Helpful Scripts](#helpful-scripts)
28-
- [Remote Deployment](#remote-deployment)
29-
- [Heroku](#heroku)
30-
- [AWS Elastic Beanstalk](#aws-elastic-beanstalk)
31-
- [Microsoft Azure App Service](#microsoft-azure-app-service)
32-
- [Google App Engine](#google-app-engine)
33-
- [Scalingo](#scalingo)
34-
- [OpenShift Online (Next Gen)](#openshift-online-next-gen)
35-
- [Using Parse Server](#using-parse-server)
36-
- [Health Check](#health-check)
37-
- [APIs and SDKs](#apis-and-sdks)
38-
- [REST API](#rest-api)
39-
- [JavaScript](#javascript)
40-
- [Android](#android)
41-
- [iOS / tvOS / iPadOS / macOS (Swift)](#ios--tvos--ipados--macos-swift)
42-
43-
# Local Development
44-
45-
1. Make sure you have a compatible Node.js version installed. Run `node --version` to see your local Node.js version. Open the `package.json` file too see which version of Node.js this example repository requires at `{ engines": { "node": "<NODE_VERSION>" } }`. Note that there may be other Parse Server version available that support older or newer Node.js versions, see the [Parse Server compatibility table](https://github.com/parse-community/parse-server#compatibility).
46-
2. Clone this repository and change directory to it.
47-
3. Run `npm install`.
48-
4. Install a MongoDB database locally from https://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x.
49-
5. Run `mongo` to connect to your database, just to make sure it's working. Once you see a mongo prompt, exit with `Control-D`.
50-
6. Launch Parse Server with `npm start`.
51-
7. By default the API route will use `/parse` as a base. You can change this by setting the environment variable `PARSE_MOUNT`, for example in the CLI run run `export PARSE_MOUNT=/app` to set the path to `app`.
52-
8. Your Parse Server is not running and is connected to your local database named `dev` in which the data is stored that you manage via Parse Server.
53-
54-
## Docker Deployment
55-
56-
You can also run Parse Server using Docker:
57-
58-
1. Create a `.env` file with your configuration variables. For example:
59-
```env
60-
APP_ID=myAppId
61-
MASTER_KEY=myMasterKey
62-
DATABASE_URI=mongodb://localhost:27017/parse
63-
PORT=1337
64-
PARSE_MOUNT=/parse
65-
```
66-
67-
2. Run Docker with the following command, mounting volumes as needed:
68-
```bash
69-
docker build -t parse-server .
70-
docker run -p 1337:1337 --env-file .env \
71-
-v $(pwd)/logs:/usr/src/parse/logs \
72-
-v $(pwd)/cloud:/usr/src/parse/cloud \
73-
parse-server
74-
```
75-
76-
This allows you to:
77-
- Use an environment file for configuration
78-
- Mount the logs directory to persist logs outside the container
79-
- Mount the cloud directory to access your Cloud Code files from the container
80-
81-
You can customize the mounted volumes based on your needs, such as mounting config files or other directories that require persistence or runtime modifications.
82-
83-
## Helpful Scripts
84-
These scripts can help you to develop your app for Parse Server:
85-
86-
* `npm run watch` will start your Parse Server and restart if you make any changes.
87-
* `npm run lint` will check the linting of your cloud code, tests and `index.ts`, as defined in `.eslintrc.json`.
88-
* `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.ts`.
89-
* `npm run prettier` will help improve the formatting and layout of your cloud code, tests and `index.ts`, as defined in `.prettierrc`.
90-
* `npm test` will run all tests
91-
* `npm run coverage` will run tests and check coverage. Output is available in the `/coverage` folder.
92-
93-
## Configuration
94-
95-
Configuration is located in `config.ts`.
96-
97-
98-
# Remote Deployment
99-
100-
## Heroku
101-
102-
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
103-
104-
Alternatively, to deploy manually:
105-
106-
* Clone the repo and change directory to it
107-
* Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create`
108-
* Use the [mLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox --app YourAppName`
109-
* 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`
110-
* Deploy it with: `git push heroku master`
111-
112-
## AWS Elastic Beanstalk
113-
114-
<a title="Deploy to AWS" href="https://console.aws.amazon.com/elasticbeanstalk/home?region=us-west-2#/newApplication?applicationName=ParseServer&solutionStackName=Node.js&tierName=WebServer&sourceBundleUrl=https://s3.amazonaws.com/elasticbeanstalk-samples-us-east-1/eb-parse-server-sample/parse-server-example.zip" target="_blank"><img src="https://d0.awsstatic.com/product-marketing/Elastic%20Beanstalk/deploy-to-aws.png" height="40"></a>
115-
116-
Alternatively, deploy your local changes manually:
117-
118-
* Clone the repo and change directory to it
119-
* 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`
120-
* Create an environment and pass in MongoDB URI, App ID, and Master Key: `eb create --envvars DATABASE_URI=<replace with URI>,APP_ID=<replace with Parse app ID>,MASTER_KEY=<replace with Parse master key>`
121-
122-
## Microsoft Azure App Service
123-
124-
[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.ParseServer)
125-
126-
Detailed information is available here:
127-
* [Parse Server with Azure Managed Services](https://azure.microsoft.com/en-us/marketplace/partners/microsoft/parseserver/)
128-
* [Parse Server Azure Blog Post](https://azure.microsoft.com/en-us/blog/announcing-the-publication-of-parse-server-with-azure-managed-services/)
129-
130-
## Google App Engine
131-
132-
1. Clone the repo and change directory to it
133-
1. Create a project in the [Google Cloud Platform Console](https://console.cloud.google.com/).
134-
1. [Enable billing](https://console.cloud.google.com/project/_/settings) for your project.
135-
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/).
136-
1. Setup a MongoDB server. You have a few options:
137-
1. Create a Google Compute Engine virtual machine with [MongoDB pre-installed](https://cloud.google.com/launcher/?q=mongodb).
138-
1. Use [mLab](https://mlab.com/google/) to create a free MongoDB deployment on Google Cloud Platform (only US-central).
139-
1. Modify `app.yaml` to update your environment variables.
140-
1. Delete `Dockerfile`
141-
1. Deploy it with `gcloud preview app deploy`
142-
143-
A detailed tutorial is available here:
144-
[Running Parse server on Google App Engine](https://cloud.google.com/nodejs/resources/frameworks/parse-server)
145-
146-
## Scalingo
147-
148-
[![Deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy)
149-
150-
Alternatively, to deploy manually:
151-
152-
* Clone the repo and change directory to it
153-
* Log in with the [Scalingo CLI](https://cli.scalingo.com/) and create an app: `scalingo create my-parse`
154-
* Use the [Scalingo MongoDB addon](https://scalingo.com/addons/scalingo-mongodb): `scalingo addons-add scalingo-mongodb free`
155-
* Setup MongoDB connection string: `scalingo env-set DATABASE_URI='$SCALINGO_MONGO_URL'`
156-
* 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`
157-
* Deploy it with: `git push scalingo master`
158-
159-
## OpenShift Online (Next Gen)
160-
161-
1. Register for a free [OpenShift Online (Next Gen) account](https://www.openshift.com/devpreview/register.html)
162-
1. Create a project in the [OpenShift Online Console](https://console.preview.openshift.com/console/).
163-
1. Install the [OpenShift CLI](https://docs.openshift.com/online/getting_started/beyond_the_basics.html#btb-installing-the-openshift-cli).
164-
1. Add the Parse Server template to your project: `oc create -f https://raw.githubusercontent.com/ParsePlatform/parse-server-example/master/openshift.json`
165-
1. Deploy Parse Server from the web console
166-
1. Open your project in the [OpenShift Online Console](https://console.preview.openshift.com/console/):
167-
1. Click **Add to Project** from the top navigation
168-
1. Scroll down and select **NodeJS > Parse Server**
169-
1. (Optionally) Update the Parse Server settings (parameters)
170-
1. Click **Create**
171-
172-
A detailed tutorial is available here:
173-
[Running Parse Server on OpenShift Online (Next Gen)](https://blog.openshift.com/parse-server/)
174-
175-
# Using Parse Server
176-
177-
## Health Check
178-
179-
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:
180-
181-
> [http://localhost:1337/parse/health](http://localhost:1337/parse/health)
182-
183-
If you deployed Parse Server remotely, change the URL accordingly.
184-
185-
## APIs and SDKs
186-
187-
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.
188-
189-
The following shows example requests when interacting with a local deployment of Parse Server. If you deployed Parse Server remotely, change the URL accordingly.
190-
191-
### REST API
192-
193-
Save object:
194-
```sh
195-
curl -X POST \
196-
-H "X-Parse-Application-Id: YOUR_APP_ID" \
197-
-H "Content-Type: application/json" \
198-
-d '{"score":1337}' \
199-
http://localhost:1337/parse/classes/GameScore
200-
```
201-
202-
Call Cloud Code function:
203-
```sh
204-
curl -X POST \
205-
-H "X-Parse-Application-Id: YOUR_APP_ID" \
206-
-H "Content-Type: application/json" \
207-
-d "{}" \
208-
http://localhost:1337/parse/functions/hello
209-
```
210-
211-
### JavaScript
212-
213-
```js
214-
// Initialize SDK
215-
Parse.initialize("YOUR_APP_ID", "unused");
216-
Parse.serverURL = 'http://localhost:1337/parse';
217-
218-
// Save object
219-
const obj = new Parse.Object('GameScore');
220-
obj.set('score',1337);
221-
await obj.save();
222-
223-
// Query object
224-
const query = new Parse.Query('GameScore');
225-
const objAgain = await query.get(obj.id);
226-
```
227-
228-
### Android
229-
```java
230-
// Initialize SDK in the application class
231-
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
232-
.applicationId("YOUR_APP_ID")
233-
.server("http://localhost:1337/parse/") // '/' important after 'parse'
234-
.build());
235-
236-
// Save object
237-
ParseObject obj = new ParseObject("TestObject");
238-
obj.put("foo", "bar");
239-
obj.saveInBackground();
240-
```
241-
242-
### iOS / tvOS / iPadOS / macOS (Swift)
243-
```swift
244-
// Initialize SDK in AppDelegate
245-
Parse.initializeWithConfiguration(ParseClientConfiguration(block: {
246-
(configuration: ParseMutableClientConfiguration) -> Void in
247-
configuration.server = "http://localhost:1337/parse/" // '/' important after 'parse'
248-
configuration.applicationId = "YOUR_APP_ID"
249-
}))
250-
```
251-
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.
252-
253-
[license-svg]: https://img.shields.io/badge/license-BSD-lightgrey.svg
254-
[license-link]: LICENSE
255-
[open-collective-link]: https://opencollective.com/parse-server
4+
* 🤖 PR by Hermes Agent: Error [ERR_REQUIRE_ESM]: require() of ES Module*

0 commit comments

Comments
 (0)