随笔分类 - node
摘要:插入后台传入前台变量 {{变量名}} 循环后台数据 <ul> {% for item in items%} <li>{{ item.title }}</li> {% endfor %} </ul> 条件渲染 {% if isTrue%} 为真 渲染此 {% else %} 否则 渲染else {%
阅读全文
摘要:在使用express 的时候报了这个错误 检索到说是 res.send() 或res.json()这类客户端返回的方法仅返回一次,如果多次返回就会出现这个错误! Express Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they
阅读全文
摘要:Express CORS 解决跨域问题 1、运行 npm install cors 安装中间件 2、使用 const cors = require('cors') 导入中间件 3、在路由之前调用 app.use(cors()) 配置中间件 cors兼容问题:IE10+、Chrome4+、FireFo
阅读全文
摘要:前提:引入fs模块 const fs = require('fs') 打开文件 //同步方式 console.log(123); let fd = fs.openSync('./abc.txt','a'); // 写入内容 fs.writeFileSync(fd,'666666') // 关闭文件
阅读全文
摘要:设置国内淘宝镜像 通过cnpm使用淘宝镜像: npm install -g cnpm --registry=https://registry.npm.taobao.org 将npm设置为淘宝镜像: npm config set registry https://registry.npm.taobao
阅读全文

浙公网安备 33010602011771号