Last active
August 29, 2015 14:01
-
-
Save chemzqm/cad35a79a46a0fac57d9 to your computer and use it in GitHub Desktop.
redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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