hash=$(git show -s -2 --format=%H)// 打印最近两次提交的hashdiff=$(git diff --stat $hash)// 对比两次提交文件的差异// newAdmin/src/pages/finance/template/detail.vue | 3 +-// newAdmin/src/pages/finance/template/item.vue | 81 ++++---------------------// newAdmin/src/router/modules/finance/template.js | 12 ++--// 3 files changed, 19 insertions(+), 77 deletions(-)
- 提取差异的文件的路径的根目录
socket.io
of 说明在 / 路径下,socket.emit(‘chat’, ‘hello world!’)的第一个参数chat 代表路由的route(‘chat’),当执行emit(‘chat’, xxxx)的时候,会触发app/io/ctronller/chat.js 中的 index 方法,但是在触发之前还要看一下有没有配置中间件,有中间件则先进入中间件。
前端在本地开发时用的是localhost或者ip的地址时,会有问题
io(`${window.location.protocol}//${url}:8889/socket`, {reconnection: false,transports: ['websocket'] // 强制使用websocket,不使用兼容模式})
接口转发,共享session和cookie
下面是透传cookie的方式
'use strict'const { Service } = require('egg')class User extends Service {async checkLogin () {const { ctx } = thisconst result = await ctx.curl('http://test', {headers: {cookie: ctx.header.cookie},dataType: 'json',timeout: 3000})return result.data}}module.exports = User
