node编程中最重要的思想之一就是模块,在 Node.js 模块系统中,每个文件都被视为独立的模块.这是这个思想,让javascript的大规模工程成为可能.模块化编程在前端大肆盛行,在node中导出: var list = {a:function(){},b:'xxxx'}; module.exports = list; module.exports是node私有的一个全局变量属性.require进行引入node导出的接口内容,可以将require看做node内置的全局函数.一般情况下是: c
Simple Redis Commands Let's start practicing using the redis key-value store from our node application. Require the redis module and assign it to a variable called redis. var redis = require('redis'); Create a redis client and assign it to a variable