NodeJS 和 ThinkJS 使用时的注意点 (一)
来源:互联网 发布:高清网络电视在线观看 编辑:程序博客网 时间:2024/06/01 07:57
1、注意大小写,SQL中不区分,而nodejs中是区分的,而sql数据库很多都会自动转成小写,取出的数据JSON,NODEJS直接调用是很方便,但也容易出错
2、不能在URL中访问,404错误时,看看Controller中的方法名中有没有Action,好几次了,也可能是我的个案
4、for(let user of users){ 中的是 of , 而不是 in , 习惯了写 for ... in ...,然后语法检查是通过的,就是结果不对
5、ThinkJS的memory缓存没有想象中的快,比如下面的递归函数:
async getChildList(pid){ let codes = await this.getCodes(); let ret = []; for(let code of codes){ if(code.c_pid == pid){ ret.push(code); let childs =await this.getChildList(code.id); for(let child of childs){ ret.push(child); } } } return ret;}改成用参数传递数组就要快得多
async getChildList(pid,codes){ let ret = []; for(let code of codes){ if(code.c_pid == pid){ ret.push(code); let childs =await this.getChildList(code.id, codes); for(let child of childs){ ret.push(child); } } } return ret;}
0 0
- NodeJS 和 ThinkJS 使用时的注意点 (一)
- thinkjs(一)
- 使用memcache的一些注意点(一)
- (一)php的基本知识和一些注意点
- sscanf的使用技巧和注意点
- MediaElement在使用时的注意点
- IP core使用时的注意点
- 使用webpack时的一些注意点
- 使用 iframe sandbox 时的注意点
- Retrofit使用时的注意点
- ARC使用和注意点
- android Activity细节(一) onSaveInstanceState()方法使用注意点
- android Activity细节(一) onSaveInstanceState()方法使用注意点
- shell注意点(一)
- JavaScript中的小技巧和注意点(一)
- NodeJs安装和需要注意的问题
- Java的操作符instanceof的使用和注意点
- 迭代器使用的注意点
- 消息队列-链表实现
- 首发
- 【路径大全】iphone所有文件路径。CYDIA
- Android网络操作和优化相关
- HDU 2602 -Bone Collector
- NodeJS 和 ThinkJS 使用时的注意点 (一)
- 缓存更新的套路
- struts2+ajaxSubmit+poi导入excel
- 循环队列
- 用jQuery实现焦点图轮播(底部是小圆点)
- Android模拟器使用PC端USB转串口调试
- HTTP 协议详解
- C++中Static用法
- sprintf与snprintf