
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
npm install njserver
var njserver = require('njserver');
njserver.use('/', './assets/');
njserver.use('/', {
dir: './controller/'
});
njserver.use('/', {
before: function (req, res, next) {
require('./interceptor/access')(req, res, next);
},
after: function (req, res, chunk, next) {
require('./interceptor/content')(req, res, chunk, next);
}
});
njserver.listen();
global.sysConfig = {
serverName: 'test', //应用名称
serverDescription: '测试系统', //应用描述
isDebug: true, //是否调试模式
servers: [{ //监听协议及端口
protocol: 'http',
port: 8081
},
{
protocol: 'https',
port: 443,
key: '94xh.com.key',
cert: '94xh.com.pem'
},
{
protocol: 'http2',
port: 8082,
key: '94xh.com.key',
cert: '94xh.com.pem'
}
],
session: {
timeout: 1800000, //session过期时间,单位ms,默认30min
store: 'mysql', //session存储介质,默认为空使用内存存储,可设置数据库类型:mysql
table: 'sessions' //存储在数据库中的表名称,结构:`njsid` varchar(255) 主键 && `session` json && `update` datetime(0)
},
sessionClearTime: '0 */30 * * * *', //每30分钟清理一次过期session
requestTimeout: 120000, //request请求超时时间,单位ms,默认120s
responseTimeout: 120000, //response响应超时时间,单位ms,默认120s
fileCacheControl: 'max-age=7200', //静态文件客户端缓存配置,默认2h过期
page404: '', //自定义404页面路径,默认不设置为空
page500: '', //自定义500页面路径,默认不设置为空
mysql: { //mysql数据库连接配置
host: '127.0.0.1', //mysql数据库主机
user: 'root', //mysql数据库用户名
password: '123456', //mysql数据库密码
database: 'test', //mysql数据库名称
supportBigNumbers: true, //处理大数字(BIGINT和DECIMAL)时需要启动此项
bigNumberStrings: true, //使用supportbignumbers和bignumberstrings时总是返回JavaScript字符串对象
multipleStatements: true, //mysql数据库查询是否支持多条语句
connectionLimit: 10, //mysql连接池创建的最大连接数
connectTimeout: 10000, //mysql连接超时时间,单位ms,默认10s
acquireTimeout: 10000, //mysql从连接池中获取连接超时时间,单位ms,默认10s
timeout: 60000, //mysql查询超时时间,单位ms,默认10s
timezone: '08:00' //mysql时区设置
},
mssql: { //mssql数据库连接配置
server: '127.0.0.1', //mssql数据库主机
user: 'sa', //mssql数据库用户名
password: '123456', //mssql数据库密码
database: 'test', //mssql数据库名称
connectionTimeout: 15000, //mssql连接超时时间,单位ms,默认15s
requestTimeout: 600000, //mssql查询超时时间,单位ms,默认15s
parseJSON: true, //将json数据集转化成json对象
multipleStatements: true, //mssql数据库查询是否支持多条语句
pool: {
max: 10, //mssql连接池创建的最大连接数
acquireTimeoutMillis: 10000, //mysql从连接池中获取连接超时时间,单位ms,默认不限制
idleTimeoutMillis: 30000 //mssq连接池空闲连接保持时间,单位ms,默认30s
}
},
tableRoute: { //数据库名称加密映射
'0000000x': 'dw_log'
},
mail: {
service: 'QQex',
auth: {
user: 'test@qq.com',
pass: '123456'
}
},
mime: { //服务器支持的MIME类型
css: 'text/css',
gif: 'image/gif',
html: 'text/html',
htm: 'text/html',
ico: 'image/x-icon',
jpeg: 'image/jpeg',
jpg: 'image/jpeg',
js: 'text/javascript',
json: 'application/json',
pdf: 'application/pdf',
png: 'image/png',
svg: 'image/svg+xml',
swf: 'application/x-shockwave-flash',
tiff: 'image/tiff',
txt: 'text/plain',
woff: 'application/font-woff',
woff2: 'application/font-woff',
ttf: 'application/octet-stream',
wav: 'audio/x-wav',
wma: 'audio/x-ms-wma',
wmv: 'video/x-ms-wmv',
xml: 'text/xml',
exe: 'application/octet-stream',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
doc:'application/msword',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
xls:'application/vnd.ms-excel',
zip: 'application/zip',
rar:' application/octet-stream',
mp4: 'video/mp4 application/octet-stream',
ppt:'application/vnd.ms-powerpoint',
pptx:'application/vnd.openxmlformats-officedocument.presentationml.presentation',
mp3:'audio/mpeg',
bmp:'image/bmp'
},
uploadType: ['gif', 'jpg', 'png', 'bmp', 'xls', 'xlsx', 'doc', 'docx', 'ppt', 'pptx', 'pdf', 'zip', 'rar', 'txt'], //允许上传文件的格式
uploadTemp: './tmp', //上传文件的临时保存路径
uploadMaxFieldsSize: 10485760, //允许POST参数大小,单位byte,默认10mb
uploadMaxFields: 1000, //允许POST参数数量
uploadMaxFileSize: 104857600, //允许上传文件的大小,单位byte,默认100mb
downloadBufferSize: 1048576, //下载文件块大小,单位byte,默认1mb
downloadFileSize: 104857600, //允许下载文件的大小,单位byte,默认100mb
log4js: { //日志配置
appenders: {
'rule-console': { //控制台打印
type: 'console'
},
'rule-access': { //用户访问记录
type: 'dateFile',
filename: './logs/access/acc.log',
encoding: 'utf-8',
pattern: 'yyyy-MM-dd',
daysToKeep: 30,
keepFileExt: true,
alwaysIncludePattern: true
},
'rule-system': { //服务器日志记录
type: 'dateFile',
filename: './logs/system/sys.log',
encoding: 'utf-8',
pattern: 'yyyy-MM-dd',
daysToKeep: 30,
keepFileExt: true,
alwaysIncludePattern: true
}
},
categories: {
default: {
appenders: ['rule-console', 'rule-system'],
level: 'debug' //服务器日志记录级别
},
access: {
'appenders': ['rule-access'],
'level': 'info' //服务器日志记录级别
}
},
pm2: true, //使用pm2启动应用
disableClustering: true //每个进程单独记录日志
}
};
FAQs
Nodejs webserver
We found that njserver 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.