-
cross-env 跨平台设置和使用环境变量
设置
{
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
}
}
使用
const NODE_ENV = process.env.NODE_ENV;
if(NODE_ENV==='production'){
}else{
}
参考:
https://www.jianshu.com/p/696bd579f9ec
https://blog.csdn.net/qq_26927285/article/details/78105510
https://github.com/kentcdodds/cross-env
-
decimal.js 金额计算
A Decimal is immutable in the sense that it is not changed by its methods.
0.3 - 0.1 // 0.19999999999999998
x = new Decimal(0.3)
x.minus(0.1) // '0.2'
x // '0.3'
参考:
https://github.com/MikeMcl/decimal.js
http://mikemcl.github.io/decimal.js/
JS判断是不是Decimal类型(正则实现) https://www.cnblogs.com/xachary/p/3631178.html
-
nodejs 日志记录
用户访问日志记录。
morgan是express默认的日志中间件,也可以脱离express,作为node.js的日志组件单独使用。
https://segmentfault.com/a/1190000007769095#articleHeader9
https://github.com/expressjs/morgan
file-stream-rotator
借助file-stream-rotator插件,可以轻松完成日志分割的工作。
https://segmentfault.com/a/1190000007769095
https://github.com/rogerc/file-stream-rotator
除了用户访问日志外的其它日志记录。
log4js
https://github.com/log4js-node/log4js-node
-
异步处理
async https://github.com/caolan/async
-
权限控制
acl https://github.com/OptimalBits/node_acl
var acl = require('acl');
var conn1 = mongoose.createConnection(mongodb.conn1.path, mongodb.conn1.options);
conn1.once('open', function dbOpen() {
acl = new acl(new acl.mongodbBackend(conn1.db, 'acl_'));
//todo acl is useful
});
-
配置信息管理(开发、生成)
config-lite https://github.com/nswbmw/config-lite
-
chalk - Terminal string styling done right

Usage
const chalk = require('chalk');
console.log(chalk.blue('Hello world!'));
参考:
https://github.com/chalk/chalk
-
connect-redis
Redis session store for Connect
https://github.com/tj/connect-redis
nodejs express 使用 redis 存储 session 或 Session存放到MongoDB http://www.360doc.com/content/15/1225/13/597197_523006640.shtml
-
connect-mongo
MongoDB session store for Express and Connect
https://github.com/jdesboeufs/connect-mongo
-
Express 开发与部署最佳实践
Express 开发与部署最佳实践 https://cnodejs.org/topic/56a3c8f47ec020ed4b96b2cd
-
formidable
A Node.js module for parsing form data, especially file uploads.
使用formidable 可以处理的 Content-Type
application/x-www-form-urlencoded 常见的form提交
multipart/form-data 文件提交
application/json 提交json格式的数据
在实际开发中,很明显可以用bodyparser和multer来分别处理表单和文件,也可以只用formidable,按需取用即可。
https://github.com/felixge/node-formidable
Express中间件,bodyparser,multer,formidable区别浅谈 https://www.jianshu.com/p/828fdf02de06
-
gm
node图片处理工具,图片水印、图片验证码、图片裁剪示例
https://github.com/aheckmann/gm
node图片处理工具gm的使用:图片水印、图片验证码、图片裁剪示例 https://blog.csdn.net/u011500781/article/details/74641391
https://blog.csdn.net/dreamer2020/article/details/51647885
-
hashids 生成短ID
A small JavaScript library to generate YouTube-like ids from numbers
https://github.com/ivanakimov/hashids.js
-
i18n-nodejs 国际化
https://github.com/eslam-mahmoud/i18n-nodejs
-
marked - A markdown parser and compiler. Built for speed.
https://github.com/markedjs/marked
Marked高效的Markdown解析器 http://blog.fens.me/nodejs-markdown-marked/
-
moment
Parse, validate, manipulate, and display dates in javascript.
https://github.com/moment/moment
-
mongodb
The official MongoDB driver for Node.js. Provides a high-level API on top of mongodb-core that is meant for end users.
https://github.com/mongodb/node-mongodb-native
-
mongoose
MongoDB object modeling designed to work in an asynchronous environment.
https://github.com/Automattic/mongoose
-
mongoose-paginate 分页
Mongoose.js (Node.js & MongoDB) Document Query Pagination
https://github.com/edwardhotchkiss/mongoose-paginate
-
node-uuid
Generate RFC-compliant UUIDs in JavaScript
https://github.com/kelektiv/node-uuid
-
node-xlsx
NodeJS excel file parser & builder
https://github.com/mgcrea/node-xlsx
-
pinyin
转换中文字符为拼音。可以用于汉字注音、排序、检索。
注:这个版本同时支持在 Node 和 Web 浏览器环境运行,
https://github.com/hotoo/pinyin
-
pm2
Node.js Production Process Manager with a built-in Load Balancer. http://pm2.io/doc
https://github.com/Unitech/pm2
你所不知道的pm2 https://blog.csdn.net/uikoo9/article/details/79018750
https://www.cnblogs.com/zqzjs/p/6210645.html
-
redis
Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, HyperLogLogs, Bitmaps. http://redis.io
https://github.com/antirez/redis
node_redis - redis client for node https://github.com/NodeRedis/node_redis
RedisDesktopManager https://github.com/uglide/RedisDesktopManager
Redis可视化工具Redis Desktop Manager使用 https://blog.csdn.net/bjyangyanfei/article/details/79298817
-
cross-fetch
Fetch API for Node, Browsers and React Native.
https://github.com/lquixada/cross-fetch
网友评论