File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 11# Node.js Getting started
22在 LeanCloud 云引擎上使用 Express 的 Node.js 示例项目。
33
4+ 若希望获取更多常见功能和代码片段,请访问 [ leancloud/leanengine-nodejs-demos] ( https://github.com/leancloud/leanengine-nodejs-demos ) 。
5+
46## 本地运行
57
68首先确认本机已经安装 [ Node.js] ( http://nodejs.org/ ) 运行环境和 [ LeanCloud 命令行工具] ( https://leancloud.cn/docs/leanengine_cli.html ) ,然后执行下列指令:
79
810```
9- $ git clone https://github.com/leancloud/node-js-getting-started.git
10- $ cd node-js-getting-started
11+ git clone https://github.com/leancloud/node-js-getting-started.git
12+ cd node-js-getting-started
1113```
1214
1315安装依赖:
Original file line number Diff line number Diff line change 1- var AV = require ( 'leanengine' ) ;
1+ const AV = require ( 'leanengine' )
2+ const fs = require ( 'fs' )
3+ const path = require ( 'path' )
4+
5+ /**
6+ * 加载 functions 目录下所有的云函数
7+ */
8+ fs . readdirSync ( path . join ( __dirname , 'functions' ) ) . forEach ( file => {
9+ require ( path . join ( __dirname , 'functions' , file ) )
10+ } )
211
312/**
413 * 一个简单的云代码方法
514 */
615AV . Cloud . define ( 'hello' , function ( request ) {
7- return 'Hello world!' ;
8- } ) ;
16+ return 'Hello world!'
17+ } )
You can’t perform that action at this time.
0 commit comments