Skip to content

Instantly share code, notes, and snippets.

@chemzqm
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chemzqm/cad35a79a46a0fac57d9 to your computer and use it in GitHub Desktop.
Save chemzqm/cad35a79a46a0fac57d9 to your computer and use it in GitHub Desktop.
redirect
#! /usr/bin/env node
// 使用方式: redirect [url]
// 手机上每次都访问 http://[你机器的ip]:3000就成了
var http = require('http');
var url = process.argv[2];
http.createServer(function (req, res) {
res.setHeader('Location', url);
res.statusCode = 302;
res.end();
}).listen(3000);
console.log('server started at 3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment