
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@jianghe/sand-noco
Advanced tools
node-core === noco 基于 koa 的扩展最佳实践.
@jianghe 每次脚手架修改完后,记得保持脚手架项目的干净,执行下 npm run clean 即可
日志有两种:一种是写到日志文件的 依赖 log4js 日志,一种是输入到控制台的 debug 日志。分别依赖 log4js 和 debug 库。sand-noco 库只对外输出基于 log4js 的一个中间件,该中间件执行后会将 logger 对象挂在到 ctx。debug 日志在具体的业务代码中自行使用。
日志分级:框架报错日志(不对外输出,sand-noco 中使用),通用日志,服务报错日志
const { loggerMiddleware, app } = require('sand-noco');
// app其实就是koa2实例
app.use(loggerMiddleware());
// 输出到日志文件的
ctx.commonLogger.info(msg)
ctx.commonLogger.error(new Error())
ctx.errorLogger.info(msg)
ctx.errorLogger.error(new Error())
errorHandlerMiddleware 该中间件是默认第一个引入的中间件,主要兜底处理异常。用 trycatch 方法包裹 await next(),捕获到未处理的 throw 异常使用 logger 直接输出
基于 koa2-cors 可自定义 cors 规则。
const { corsMiddleware, app } = require('sand-noco');
// app 其实就是 koa2 实例
app.use(corsMiddleware(getCors()));
基于 koa-views 和 ejs
const { viewMiddleware, app } = require('sand-noco');
// app 其实就是 koa2 实例
app.use(viewMiddleware({
// 传入视图路径
viewsPath:'',
}));
FAQs
node
We found that @jianghe/sand-noco demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.