博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
express 邮件发送_使用Express发送回复
阅读量:2510 次
发布时间:2019-05-11

本文共 1360 字,大约阅读时间需要 4 分钟。

express 邮件发送

In the Hello World example we used the Response.send() method to send a simple string as a response, and to close the connection:

在Hello World示例中,我们使用Response.send()方法发送一个简单字符串作为响应,并关闭连接:

(req, res) => res.send('Hello World!')

If you pass in a string, it sets the Content-Type header to text/html.

如果传入字符串,它将Content-Type标头设置为text/html

if you pass in an object or an array, it sets the application/json Content-Type header, and parses that parameter into .

如果传入对象或数组,它将设置application/json Content-Type标头,并将该参数解析为 。

send() automatically sets the Content-Length HTTP response header.

send()自动设置Content-Length HTTP响应标头。

send() also automatically closes the connection.

send()也会自动关闭连接。

使用end()发送空响应 (Use end() to send an empty response)

An alternative way to send the response, without any body, it’s by using the Response.end() method:

没有任何内容的另一种发送响应的方法是使用Response.end()方法:

res.end()

设置HTTP响应状态 (Set the HTTP response status)

Use the Response.status():

使用Response.status()

res.status(404).end()

or

要么

res.status(404).send('File not found')

sendStatus() is a shortcut:

sendStatus()是一个快捷方式:

res.sendStatus(200)// === res.status(200).send('OK')res.sendStatus(403)// === res.status(403).send('Forbidden')res.sendStatus(404)// === res.status(404).send('Not Found')res.sendStatus(500)// === res.status(500).send('Internal Server Error')

翻译自:

express 邮件发送

转载地址:http://qvqgb.baihongyu.com/

你可能感兴趣的文章
NSTextView 文字链接的定制化
查看>>
第五天站立会议内容
查看>>
CentOs7安装rabbitmq
查看>>
(转))iOS App上架AppStore 会遇到的坑
查看>>
解决vmware与主机无法连通的问题
查看>>
做好产品
查看>>
项目管理经验
查看>>
笔记:Hadoop权威指南 第8章 MapReduce 的特性
查看>>
JMeter响应数据出现乱码的处理-三种解决方式
查看>>
获取设备实际宽度
查看>>
图的算法专题——最短路径
查看>>
SQL批量删除与批量插入
查看>>
Notes on <High Performance MySQL> -- Ch3: Schema Optimization and Indexing
查看>>
C语言之一般树
查看>>
懂了很多大道理,却依旧过不好一生
查看>>
手工数据结构系列-C语言模拟队列 hdu1276
查看>>
【PyQt5 学习记录】008:改变窗口样式之二
查看>>
android EditText长按屏蔽ActionMode context菜单但保留选择工具功能
查看>>
BUAA 111 圆有点挤
查看>>
c++ 继承产生的名字冲突问题 (1)
查看>>