nodejs客户端如何向服务器发起http请求以及响应

http.createServer( function (request, response) {}).listen(8080);
createServer 方法 可以创建一个客户端和服务器端响应请求。
function 回调函数处理的就是 接收过程。
request 就是 所有请求信息
response 所有响应信息
listen 方法 监听端口

//index.html页面
 <link rel="stylesheet" href="./static/1.css">
<body>
    <img src="./static/2.jpg" alt="">
    <h1>我是首页</h1>
    <img src="/static/1.jpg" alt="">
    <a href="./aboutus?id=10">关于我们</a><br>
    <form action="/aboutus" method="POST">
        <button type="submit">提交</button>
    </form>
</body>
<script src="./static/1.js"></script>
//aboutus.html页面
<body>
    <h1>关于我们<%=query%></h1>
    <img src="/static/1.jpg" alt="">
</body>

纯地址页面,不传参

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值