随笔分类 - JavaScript / node
摘要:报错截图: 解决方案: npm官网方案:https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally 简而言之有两种解决方案,方案一:升级node,方案二:切换npm的全局安装
阅读全文
摘要:使用淘宝源 npm install --registry=https://registry.npm.taobao.org
阅读全文
摘要:JWT 的使用 用户登录,服务器端产生一个token(加密字符串)发送给客户端 客户端将token保存起来(随便怎么存,cookie,local storage,状态管理) 客户端发起请求的时候携带token 服务器端验证token const jwt=require('jsonwebtoken')
阅读全文
摘要:服务端(node) var express = require('express'); var app = express(); var server = require('http').Server(app); var ws = require('socket.io')(server); //将s
阅读全文
摘要:服务端代码(node) const WebSocket = require('ws') const ws = new WebSocket.Server({ port: 8080 },()=>{ console.log('socket start') }) // 创建服务器 // 连接监听 cline
阅读全文

浙公网安备 33010602011771号