• express respond.send 和 end的区别


    自己开发的公众号,可以领取淘宝内部优惠券

    做个记录

    res.send() will send the HTTP response. Its syntax is,

    res.send([body])
    

    The body parameter can be a Buffer object, a String, an object, or an Array. For example:

    res.send(new Buffer('whoop'));
    res.send({ some: 'json' });
    res.send('<p>some html</p>');
    res.status(404).send('Sorry, we cannot find that!');
    res.status(500).send({ error: 'something blew up' });
    

      

    See this for more info.

    res.end() will end the response process. This method actually comes from Node core, specifically the response.end() method of http.ServerResponse. It is used to quickly end the response without any data. For example:

    res.end();
    res.status(404).end();

    Read this for more info.

  • 相关阅读:
    golang语法要点笔记
    环境配置
    实现chrome多用户独立cookie
    Golang遇到的问题记录
    php preg_replace去除html xml 注释
    C 基础
    多种写法
    mysql 查看当前数据库
    sql group by
    sql CONCAT()
  • 原文地址:https://www.cnblogs.com/yehuabin/p/8143362.html
Copyright © 2020-2023  润新知