matjs / mat Goto Github PK
View Code? Open in Web Editor NEW一个简单命令行工具,提供基础的任务和代理功能
Home Page: http://matjs.com
License: MIT License
一个简单命令行工具,提供基础的任务和代理功能
Home Page: http://matjs.com
License: MIT License
/**
* 判断请求url是否符合白名单
*/
Url.prototype._match = function (url) {
var rules = this.rules
var len = rules.length
var flag
for (var i = 0; i < len; i++) {
var rule = rules[i]
if (_.isFunction(rule)) {
flag = rule(url)
} else {
flag = rule.test(url)
}
if (flag) {
break
}
}
return flag
}
如果是restful风格的接口或者是.html结尾的json接口,rule
是个自定义的函数,但传递的参数url很难判断是json接口。如果是通过this.headers.accept.indexOf('application/json') === -1
去判断能跟准确些
index.js
Mat.prototype.env = function (env) {
if (env.ready) {
Mat.prototype.ready = env.ready
}
}
let server = app.listen(app.port, function () {
log.info()
log.info(chalk.green('Mat is running on ' + app.port))
log.info()
me.ready && me.ready()
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.