Comparing version 0.0.1 to 0.0.2
67
index.js
@@ -0,3 +1,68 @@ | ||
var http = require('http'); | ||
module.exports = function(){ | ||
return 'angry.js'; | ||
var app = function app(req, res){ | ||
var pathAndQuery = req.url.split('?', 2); | ||
var path = req.path = pathAndQuery[0]; | ||
req.querystring = pathAndQuery[1]; | ||
var method = req.method; | ||
var index = -1; | ||
var next = function(){ | ||
app.getHandlers(method, path)[++index](req, res, next); | ||
}; | ||
next(); | ||
}; | ||
app.stacks = []; | ||
app.use = function(route, handler){ | ||
if(typeof route == 'function'){ | ||
handler = route; | ||
route = '*'; | ||
} | ||
this.stacks.push({ | ||
route: route, | ||
method: '*', | ||
handler: handler | ||
}); | ||
}; | ||
app.getHandlers = function(method, path){ | ||
var handlers = []; | ||
this.stacks.forEach(function(stack){ | ||
if(stack.method == '*' || (stack.method.toUpperCase()) == method){ | ||
if(stack.route == '*' || stack.route == path) | ||
handlers.push(stack.handler); | ||
} | ||
}); | ||
handlers.push(this.errHandler); | ||
return handlers; | ||
}; | ||
app.errHandler = function(req, res){ | ||
res.statusCode = 404; | ||
res.end('error'); | ||
}; | ||
app.listen = function(port, callback){ | ||
this.server = http.createServer(app); | ||
this.server.listen(port, callback); | ||
return this.server; | ||
}; | ||
([ 'get', 'delete', 'post', 'put' ]).forEach(function(method){ | ||
app[ method ] = function(route, handler){ | ||
app.stacks.push({ | ||
route: route, | ||
method: method, | ||
handler: handler | ||
}); | ||
}; | ||
}); | ||
return app; | ||
}; | ||
module.exports.Request = require('./libs/request'); | ||
module.exports.Response = require('./libs/response'); |
{ | ||
"name": "angry", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "This is a funny project that born angry. ", | ||
@@ -19,5 +19,11 @@ "main": "index.js", | ||
"bugs": { | ||
"url": "https://github.com/angryjs-io/angry.js/issues" | ||
"url": "https://github.com/angry-js/angry.js/issues" | ||
}, | ||
"homepage": "https://github.com/angryjs-io/angry.js" | ||
"homepage": "https://github.com/angry-js/angry.js", | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"dependencies": { | ||
"mime": "*" | ||
} | ||
} |
## angry.js  | ||
This is a funny project that born angry. | ||
This is a funny project that born angry. | ||
@@ -15,2 +15,12 @@ ### Installation | ||
var angry = require('angry'); | ||
var app = angry(); | ||
app.get('/', function(req, res){ | ||
res.send('hello world'); | ||
}); | ||
var server = app.listen(4000, function(){ | ||
console.log('server is running at %s', server.address().port); | ||
}); | ||
```` | ||
@@ -17,0 +27,0 @@ |
var angry = require('../'); | ||
console.log( angry() ); | ||
var app = angry(); | ||
app.get('/', function(req, res){ | ||
res.send('hello world'); | ||
}); | ||
var server = app.listen(4000, function(){ | ||
console.log('server is running at %s', server.address().port); | ||
}); |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5462
8
117
60
1
1
2
3
+ Addedmime@*
+ Addedmime@4.0.6(transitive)