GithubHelp home page GithubHelp logo

theashraf / parse-cloud-function Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 2.77 MB

Create scalable & reusable parse cloud functions with middlewares

License: MIT License

JavaScript 100.00%
parse-server parse middleware code cloud

parse-cloud-function's Introduction

Parse Cloud Function

npm license npm semantic-release code style: prettier

Create scalable parse cloud functions

Parse Cloud Function helps in adding middlewares to cloud functions for more clean,reusable and scalable cloud code

Installation

npm install --save parse-cloud-function

Example

A working example can be found here

Supported versions

  • parse-server >= 3.0.0
  • node >= 6.4

Basic Usage

//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

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

parse-cloud-function's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar theashraf avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

radandevist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.