1.安装node;
node -v //检测node是否安装成功
node可以做什么:
- 搭建服务器;
- 读写文件;
- 连接数据库;
- 爬虫;
node的模块系统:
- 原生模块(如http,fs);
- 自定义模块;
- 第三方模块(如gulp)
module.exports和exports的区别:
导出对象用module.exports;
导出多个方法和变量用exports;
搭建服务器时候出错:
NodeJS错误-throw er; // Unhandled 'error' event
原因:
端口号被占用;
解决:
listen(更换端口号)
参照:
https://www.cnblogs.com/xiaofeixiang/p/4921276.html