コード例 #1
0
ファイル: mime.js プロジェクト: jixiangac/startserver
  ".jpeg": "image/jpeg",
  ".jpg": "image/jpeg",
  ".js": "text/javascript",
  ".json": "application/json",
  ".pdf": "application/pdf",
  ".png": "image/png",
  ".svg": "image/svg+xml",
  ".swf": "application/x-shockwave-flash",
  ".tiff": "image/tiff",
  ".txt": "text/plain",
  ".wav": "audio/x-wav",
  ".wma": "audio/x-ms-wma",
  ".wmv": "video/x-ms-wmv",
  ".xml": "text/xml",
  ".swp": "text/html",
  ".md": "text/html"
};

function Mime(){
}

var proto = {
  lookUp:function(type){
    return mime[type]? mime[type] : mime['.txt'];
  }
};

util.augment(Mime, proto);

module.exports = new Mime();
コード例 #2
0
ファイル: startserver.js プロジェクト: ottomao/startserver
 *
 * ================================================================ */

'use strict';

var util = require('xutil');
var EventEmitter = require('events').EventEmitter;
var http = require('http');

// add event target
util.inherits(StartServer, EventEmitter);

//augment function
util.augment(StartServer, {
  listen: _listen,
  bundle: _bundle,
  bind: _bind
});

module.exports = StartServer;

/**
 * constructor function
 */
function StartServer() {
  var that = this;
  that.stack = [];
  that.bind();
}

/**