当前位置: 首页>>代码示例>>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;未经允许,请勿转载。