How to use the leanengine.initialize function in leanengine

To help you get started, we’ve selected a few leanengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hACKbUSTER / UberGuide-Server / server.js View on Github external
'use strict';
var AV = require('leanengine');
global.AV = AV;

var APP_ID = process.env.LC_APP_ID;
var APP_KEY = process.env.LC_APP_KEY;
var MASTER_KEY = process.env.LC_APP_MASTER_KEY;

AV.initialize(APP_ID, APP_KEY, MASTER_KEY);
// 如果不希望使用 masterKey 权限,可以将下面一行删除
AV.Cloud.useMasterKey();

var app = require('./app');

// 端口一定要从环境变量 `LC_APP_PORT` 中获取。
// LeanEngine 运行时会分配端口并赋值到该变量。
var PORT = parseInt(process.env.LC_APP_PORT || 3000);
app.listen(PORT, function () {
  console.log('Node app is running, port:', PORT);
});
github xiaokaike / magic-upload-image / server / lean-server.js View on Github external
* upload file save in leancloud 
 */

var fs = require('fs')
var express = require('express')
var path = require('path')
var AV = require('leanengine')
var app = express()
var busboy = require('connect-busboy')

var APP_ID = process.env.LC_APP_ID
var APP_KEY = process.env.LC_APP_KEY
var MASTER_KEY = process.env.LC_APP_MASTER_KEY
var PORT = parseInt(process.env.LC_APP_PORT || 3002)

AV.initialize(APP_ID, APP_KEY, MASTER_KEY);

// 使用这个中间件
app.use(AV.Cloud)
app.use(busboy())
app.use(express.static(path.join(__dirname, '../public/')))

app.post('/upload', function(req, res) {
  if (req.busboy) {
    var base64data = [];
    var pubFileName = '';
    var pubMimeType = '';
    req.busboy.on('file', (fieldname, file, fileName, encoding, mimeType) => {
      var buffer = '';
      pubFileName = fileName;
      pubMimeType = mimeType;
      file.setEncoding('base64');
github hilongjw / vue-zhihu-daily / server / config.js View on Github external
const AV = require('leanengine')

const config = {
    appId: 'iNKea3geGtJ1XIk7jmNKCw5O-gzGzoHsz',
    appKey: 'JnHcoPkcnmyQNhHyzNyY0pUR'
}

AV.initialize(config.appId, config.appKey)
AV.Cloud.useMasterKey()

exports.AV = AV