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


TypeScript finalhandler.default函數代碼示例

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


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

示例1: sendEmptyResponse

    var server = http.createServer(function (request:http.ServerRequest, response:http.ServerResponse) {
//        console.log((new Date()) + ' Received request for ' + request.url);
//        response.writeHead(404);
//        response.end();
        var handled = false;
        if (request.method === 'POST') {
            handled = true;
            var url = request.url;
            if (url === '/__jalangi_startup__') {
                console.log("starting up");
                writeStream = fs.createWriteStream(OUTPUT_FILE_NAME);
                sendEmptyResponse(response);
            } else if (url === '/__jalangi_close__') {
                writeStream.end("", function () {
                    console.log("done writing log")
                });
                sendEmptyResponse(response);
            } else if (url === '/__jalangi_mem_trace__') {
                var data = '';
                request.on('data', function (chunk:string) {
                    data += chunk;
                });
                request.on('end', function () {
                    writeStream.write(data);
                    sendEmptyResponse(response);
                })
            } else {
                handled = false;
            }
        }
        if (!handled) {
            var done = finalhandler(request, response);
            serve(request, response, done);
        }
    });
開發者ID:KrupaR,項目名稱:meminsight,代碼行數:35,代碼來源:httpServer.ts

示例2: finalhandler

 appServer = http.createServer(function(req, res){
     var done = finalhandler(req, res);
     serve(req, res, done);
 });
開發者ID:KrupaR,項目名稱:meminsight,代碼行數:4,代碼來源:server.ts

示例3: finalHandler

import {ServerRequest, ServerResponse} from "http";
import finalHandler from "finalhandler";

let req: ServerRequest;
let res: ServerResponse;
let options: {
	onerror: (err: any, req: ServerRequest, res: ServerResponse) => void;
	message: boolean|((err: any, status: number) => string);
	stacktrace: boolean;
};

let result: (err: any) => void;

result = finalHandler(req, res);
result = finalHandler(req, res, options);
開發者ID:rchaser53,項目名稱:DefinitelyTyped,代碼行數:15,代碼來源:finalhandler-tests.ts

示例4: createServer

const server = createServer((req, res) => {
  serve(req, res, finalhandler(req, res));
});
開發者ID:felixfbecker,項目名稱:typed-serve-static,代碼行數:3,代碼來源:test.ts

示例5: createServer

 const server = createServer((request, response) => {
   serve(request, response, finalHandler(request, response))
 })
開發者ID:jwheare,項目名稱:electron-builder,代碼行數:3,代碼來源:differentialUpdateTest.ts


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