node_modules

This commit is contained in:
saeid
2019-07-15 13:07:31 +04:30
parent d3735c6d30
commit ce1a3ebf9c
35713 changed files with 3639219 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
var http = require('http');
var helpers = {};
helpers.server = function(opts) {
var default_headers = {'Content-Type': 'text/html'};
var finish = function(req, res) {
res.writeHead(opts.code || 200, opts.headers || default_headers);
res.end(opts.response || 'Hello there.');
}
var server = http.createServer(function(req, res){
setTimeout(function(){
finish(req, res);
}, opts.wait || 0);
})
server.listen(opts.port);
return server;
}
module.exports = helpers;