Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theashraf/parse-cloud-function
Create scalable & reusable parse cloud functions with middlewares
https://github.com/theashraf/parse-cloud-function
cloud code middleware parse parse-server
Last synced: about 1 month ago
JSON representation
Create scalable & reusable parse cloud functions with middlewares
- Host: GitHub
- URL: https://github.com/theashraf/parse-cloud-function
- Owner: theashraf
- License: mit
- Created: 2018-12-29T15:07:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T19:59:45.000Z (over 3 years ago)
- Last Synced: 2024-12-15T08:03:42.799Z (about 2 months ago)
- Topics: cloud, code, middleware, parse, parse-server
- Language: JavaScript
- Homepage:
- Size: 2.7 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Parse Cloud Function
[![npm](https://img.shields.io/npm/v/parse-cloud-function.svg)](https://www.npmjs.com/package/parse-cloud-function)
[![license](https://img.shields.io/github/license/theashraf/parse-cloud-function.svg)](https://github.com/theashraf/parse-cloud-function/blob/master/LICENSE)
[![npm](https://img.shields.io/npm/dw/parse-cloud-function.svg)](https://www.npmjs.com/package/parse-cloud-function)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](#badge)> Create scalable parse cloud functions
Parse Cloud Function helps in adding middlewares to cloud functions for more clean,reusable and scalable cloud code
## Installation
```sh
npm install --save parse-cloud-function
```## Example
A working example can be found [here](example)
### Supported versions
- parse-server >= 3.0.0
- node >= 6.4### Basic Usage
```js
//parse cloud code file
const CloudFunction = require('parse-cloud-function')
const authMiddleware = async req => {
if (!req.user) throw 'unauthorized'
return req // passes the req to the next middleware function
}
const anotherMiddleware = async req => {
req.data = 'some data'
return req
}
new CloudFunction(Parse)
.use([authMiddleware, anotherMiddleware])
.define('myFunction', async req => {
console.log(req.data) // 'some data'
return 'success'
})
```## Development setup
```sh
npm install && npm run dev
```## Contribution
1. Fork the project
2. Create your feature branch (`git checkout -b feature/fooBar`), or hotfix branch (`git checkout -b hotfix/fooBar`)
3. Commit your changes (`npm run cz`)
4. Push to the feature branch (`git push origin feature/fooBar`), or hotfix branch (`git push origin hotfix/fooBar`)
5. Create a new Pull Request