Subash
Subash

Reputation: 1000

How to install external javascript libraries on Parse cloud code

I am using these javascript libraries in my Parse cloud code.

var request = require('request');
var fs = require('fs');
var Twit = require('twit');

The code will not compile unless I have these installed on the parse server. I am still using the parse server hosted by parse. How can I install these libraries in the parse server. Thanks in advance.

Upvotes: 0

Views: 456

Answers (1)

Ran Hassid
Ran Hassid

Reputation: 2788

in parse.com service you cannot add your own libraries to cloud code. If you want to integrate with http api you can use Parse.Cloud.httpRequest

In parse-server its totally different because there you have the freedom to add any library that you want. In order to add a new library to parse server cloud code you need to do the following:

  1. In your parse-server project open the pacakage.json file
  2. Add your dependency under dependencies - you can add any library which available in NPM repository (which is actually... everything :) )
  3. In command line run npm install in order to install the new dependency into your parse server
  4. Go to cloud code and require this library and use it..

That's it.

Upvotes: 2

Related Questions