### egg post失敗【message: 'invalid csrf token'】
> 開發API時
``` js
// 在 config.default.js 中禁用 csrf
security: {
csrf: {
enable: false,
},
}
```
> 后端渲染模板時
``` js
//設置全局變量
ctx.state.csrf = ctx.csrf;
//前端post上傳時需要帶上該參數
<input type="hidden" name="_csrf" value="<%=csrf%>">
```