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 1
1
# Node.js Getting started
2
2
在 LeanCloud 云引擎上使用 Express 的 Node.js 示例项目。
3
3
4
+ 若希望获取更多常见功能和代码片段,请访问 [ leancloud/leanengine-nodejs-demos] ( https://github.com/leancloud/leanengine-nodejs-demos ) 。
5
+
4
6
## 本地运行
5
7
6
8
首先确认本机已经安装 [ Node.js] ( http://nodejs.org/ ) 运行环境和 [ LeanCloud 命令行工具] ( https://leancloud.cn/docs/leanengine_cli.html ) ,然后执行下列指令:
7
9
8
10
```
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
11
13
```
12
14
13
15
安装依赖:
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
+ } )
2
11
3
12
/**
4
13
* 一个简单的云代码方法
5
14
*/
6
15
AV . 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