zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    常用源代码管理工具与开发工具
    项目发布
    学期总结
    个人博客
    个人博客
    阅读笔记6
    阅读笔记5
    阅读笔记4
    团队代码
    团队代码
  • 原文地址:https://www.cnblogs.com/yehuabin/p/8143362.html
Copyright © 2011-2022 走看看