[Homfen] # _

Stay hungry, stay foolish.

Recent Posts

Node.js命令行程序

published on

Node.js也是可以写命令行程序的,与Web程序的不同之处就在于package.json的设置

需要在package.json中添加如下配置

Read More...

Express.js Get Client IP

published on

Express中如果想获取客户端的IP,首先要设置trust proxy:

app.set('trust proxy', 1);
// or
app.enable('trust proxy');

设置完之后,就可以从req中取到IP了:

var ip = req.ip;
// or
ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;

Read More...

Categories

其他技术 (8)

前端技术 (9)

后端技术 (2)

工具使用 (3)

Tags

android (2) centos (1) chrome (1) commandline (1) express.js (1) git (1) immutable (1) javascript (3) kobold2d (1) mac (1) nginx (1) node.js (2) oh-my-zsh (1) polymer (1) responsive (1) shell (1) snap (1) sublime (2) svg (2) tomcat (1) vim (1) vsftpd (1) zsh (1)

Friends

Huajh7 FMJ Pacoirene Blackboy