當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript express.logger函數代碼示例

本文整理匯總了TypeScript中express.logger函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript logger函數的具體用法?TypeScript logger怎麽用?TypeScript logger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了logger函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

app.configure(function () {
    app.use(express.favicon());
    app.use(express.logger());
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(path.join(application_root, "public")));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
開發者ID:Sally-Xu,項目名稱:Fayde.Demo,代碼行數:9,代碼來源:server.ts

示例2:

app.configure(()=>{
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});
開發者ID:kaipu1224,項目名稱:typescript-express,代碼行數:11,代碼來源:app.ts

示例3: express

var app = express();
app.get('/', function (req, res) {
    res.status(200).send('ok');
});
var server = app.listen(3000, function () {
    var port = server.address().port;
    console.log('Example app listening at port %s', port);
});


// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);

import stylus = require('stylus');
app.use(stylus.middleware(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
    app.use(express.errorHandler());
}

app.get('/', routes.index);
開發者ID:nrouelle,項目名稱:KeepItUp,代碼行數:31,代碼來源:server.ts

示例4:

app.configure(function () {
    app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
});
開發者ID:arein,項目名稱:Mils-Server,代碼行數:3,代碼來源:app.ts

示例5: require

var renderJson = require("./renderJson");
var _ = require("underscore");


var flash = require("connect-flash");
var passport = require("passport");
var LocalStrategy = require("passport-local").Strategy;

var app = express();

app.set("port", process.env.PORT || 3000);
app.set("views", __dirname + "/views");
app.set("view engine", "jade");

app.use(express.favicon());
app.use(express.logger("dev"));
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(flash());
app.use(express.methodOverride());
app.use(passport.initialize());
app.use(passport.session());
app.use(function (req, res, next) {
    res.locals.baseUrl = "" + req.protocol + "://" + (req.get('host')) + req.path;
    var url = function (basePath : string, relPath : string) : string {
        var baseSegments, newBasePath;

        if (!relPath) {
            return basePath;
        } else if (relPath.indexOf("../") === 0) {
開發者ID:Antares007,項目名稱:AiPos,代碼行數:31,代碼來源:app.ts


注:本文中的express.logger函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。