Reputation: 1
I am working on an application in which i need to take the parse server time and convert it into the New York timezone for which i am using moment.js
and moment-timezone.js
.
I am struggling with giving the reference to this external js files in my cloud code.
Upvotes: 0
Views: 359
Reputation: 38526
You can require other files in your cloud/
folder by adding that path:
require('cloud/myfile.js');
Typically, they are in the module format: http://wiki.commonjs.org/wiki/Modules/1.1.1
myModule.js:
exports.add = function(a, b) { return a+b; }
main.js:
var myModule = require('cloud/myModule.js');
myModule.add(2, 2);
for moment, it should be:
var moment = require('cloud/moment.js');
var now = moment().format();
Upvotes: 1