Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var AV = require('leanengine');
AV.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
});
// 如果不希望使用 masterKey 权限,可以将下面一行删除
// AV.Cloud.useMasterKey();
var app = require('./app');
// 端口一定要从环境变量 `LEANCLOUD_APP_PORT` 中获取。
// LeanEngine 运行时会分配端口并赋值到该变量。
var PORT = parseInt(process.env.LEANCLOUD_APP_PORT || process.env.PORT || 3000);
process.env.TZ = 'Asia/Chongqing';
app.listen(PORT, function (err) {
console.log('Node app is running on port:', PORT);
var workerpool = require('workerpool');
var bodyParser = require('body-parser');
var AV = require('leanengine');
var TextMessage = require('leancloud-realtime').TextMessage;
var app = express();
app.use(bodyParser.json());
var pool = workerpool.pool(__dirname + '/math_worker.js');
var TIMEOUT = 10000; // milliseconds
var APP_ID = process.env.LC_APP_ID; // your app id
var APP_KEY = process.env.LC_APP_KEY; // your app key
var MASTER_KEY = process.env.LC_APP_MASTER_KEY; // your app master key
AV.init({
'appId': APP_ID,
'appKey': APP_KEY,
'masterKey': MASTER_KEY
});
var MATH_CONV_ID = process.env.MATH_CONV_ID;
app.post('/webhook', function (req, res) {
var messages = req.body;
console.log('messages recieved: ' + JSON.stringify(messages));
// 过滤掉暂态消息与非通过 MathBot 对话发过来的消息
messages
.filter(message => !message.noPersist)
.filter(message => message.conv.objectId === MATH_CONV_ID)
.forEach(function (message) {
var convId = message.conv.objectId;
'use strict';
var AV = require('leanengine');
AV.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
});
AV.Cloud.useMasterKey();
var app = require('./app');
// 端口一定要从环境变量 `LEANCLOUD_APP_PORT` 中获取。
// LeanEngine 运行时会分配端口并赋值到该变量。
var PORT = parseInt(process.env.LEANCLOUD_APP_PORT || process.env.PORT || 3000);
app.listen(PORT, function (err) {
console.log('Node app is running on port:', PORT);
// 注册全局未捕获异常处理器
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import Lean from 'leanengine'
import cloud from './cloud'
// Local dependencies
import {
API,
uncaughtException,
CORS,
errorHandler,
notFound,
} from './routes'
// LeanEngine Setup
Lean.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
})
// 如果不希望使用 masterKey 权限,可以删除
Lean.Cloud.useMasterKey()
// Init Express App
const app = express()
// Middlewares and Routes
app.use(express.static('dist'))
app.use(timeout('15s'))
app.use(Lean.express())
app.use(bodyParser.json())
const express = require('express')
const AV = require('leanengine')
const axios = require('axios')
const path = require('path')
AV.init({
appId: process.env.LEANCLOUD_APP_ID || 'Cct4URhkJo6VKYACsR3MklFt-gzGzoHsz',
appKey: process.env.LEANCLOUD_APP_KEY || 'BeJzllYAryhOzoNX0piav8tw',
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY || 'U5jcAlilltDr1vJmyfwIqC2D'
})
const app = express()
app.use(AV.express())
app.use(express.static(path.resolve(__dirname, './dist')))
const V2EX_BASE_URL = 'https://www.v2ex.com/api'
// v2ex topic info
app.get('/news/v2ex/topics/show.json?', function (req, response) {
let url = ''
if (req.query.id) {
const id = req.query.id
const AV = require('leanengine');
AV.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
});
const app = require('./app');
const port = process.env.LEANCLOUD_APP_PORT || 3000;
app.listen(port, () => {
console.log('LeanCloud GraphQL is started on', port);
});
module.exports = app;
const AV = require('leanengine');
const express = require('express');
AV.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
});
//是否启用masterkey
AV.Cloud.useMasterKey();
const app = require('./app/app');
app.use(express.static('./app/public'));
const PORT = parseInt(process.env.LEANCLOUD_APP_PORT || 3000);
//启动服务器
app.listen(PORT, function (err) {
console.log('app is running on port 3000');
import app from './express-app'
import AV from 'leanengine'
AV.init({
appId: process.env.LEANCLOUD_APP_ID,
appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
})
app.use(AV.express())
export default app