Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-bird

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-bird - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

29

app.js

@@ -10,4 +10,29 @@ var fileServer = require("./index");

};
var transRules = {
"7676": {
//目标服务器的ip和端口,域名也可,但注意不要被host了
targetServer: {
"host": "10.46.133.242",//gcrm
"port": "8101"
// "host": "172.21.206.166",//gcrm
// "port": "8080"
// "host": "172.21.206.84",//gcrm
// "port": "8081"
},
//特殊请求转发,可选配置,内部的host、port和attachHeaders为可选参数
regExpPath: {
"gcrm/" : {
path : "gcrm/"
}
// ,
// "vendor/": {
// "host": "127.0.0.1",
// "port": "7777",
// "path": "vendor/"
// }
}
},
"ajaxOnly": false
};
fileServer.start(serverSettings);
fileServer.start(serverSettings, transRules);

8

index.js

@@ -35,3 +35,3 @@ var http = require("http");

module.exports = {
start: function (params) {
start: function (params, rules) {
var servers = params || {};

@@ -52,3 +52,3 @@ var serverList = [];

if (typeof transpond === "function") {
transpond(req, res);
transpond(req, res, rules);
}

@@ -59,7 +59,7 @@ return false;

var pathHandle = function (realPath) {
console.log(realPath);
// console.log(realPath);
fs.stat(realPath, function (err, stats) {
if (err) {
if (typeof transpond === "function") {
transpond(req, res);
transpond(req, res, rules);
} else {

@@ -66,0 +66,0 @@ //console.log(req.url + " 404");

{
"name": "gulp-bird",
"version": "0.0.1",
"version": "0.0.2",
"description": "bird-v2",

@@ -5,0 +5,0 @@ "keywords": ["bird","gulp"],

@@ -5,31 +5,6 @@ var http = require("http");

module.exports = function () {
this.transpond = function (req, res) {
this.transpond = function (req, res, transRules) {
var port = req.headers.host.split(":")[1] || 80;
delete require.cache[path.join(__dirname, "../../config.js")];
var transRules = {
"7676": {
//目标服务器的ip和端口,域名也可,但注意不要被host了
targetServer: {
"host": "10.46.133.242",//gcrm
"port": "8101"
// "host": "172.21.206.166",//gcrm
// "port": "8080"
// "host": "172.21.206.84",//gcrm
// "port": "8081"
},
//特殊请求转发,可选配置,内部的host、port和attachHeaders为可选参数
regExpPath: {
"gcrm/" : {
path : "gcrm/"
}
// ,
// "vendor/": {
// "host": "127.0.0.1",
// "port": "7777",
// "path": "vendor/"
// }
}
},
"ajaxOnly": false
};
if (transRules.ajaxOnly && !req.headers.accept.match(/application\/json, text\/javascript/)) {

@@ -36,0 +11,0 @@ res.writeHead("404");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc