学习搭建服务器可用postman 连接不了localhost的端口

网上好多教程是这样连接

看完视频后我们是这样

找了大量资料都解决不了,什么版本,什么证书的都不好使,最简单的就是去掉http://

//get 测试

const http=require('http')
const querystring=require('querystring') const server=http.createServer((req, res)=>{ //GET
console.log('method',req.method)
const url=req.url
// /
console.log('url:',url)
req.query=querystring.parse(url.split('?')[])
console.log('query:',req.query) res.end(
JSON.stringify(req.query)
) }) server.listen()
console.log('测试get')

node get

const http=require('http')
const server=http.createServer((req, res) =>{
if(req.method==='POST'){ console.log('content-type',req.headers['content-type']) let postData=""
req.on('data',chunk=>{
postData+=chunk.toString()
})
req.on('end',()=>{
console.log(postData)
res.end('post请求执行结束')
})
}
})
server.listen();
console.log('post请求执行开始')

node post

测试代码

postman连接不了localhost问题解决的更多相关文章

  1. SQLServerException:通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。

    一.问题描述: 1.连接数据库时抛出的异常: com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 localhost 的 ...

  2. postman连接mysql执行操作

    postman也可以连接mysql 目录 1.安装 2.启动服务 3.执行sql语句 1.安装 想要postman连接mysql,需要安装xmysql,启动该服务,然后才可以调用. 预置条件:完成no ...

  3. 【转】Java JDBC连接SQL Server2005错误:通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败

    错误原因如下: Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot ...

  4. Java JDBC连接SQL Server2005错误:通过port 1433 连接到主机 localhost 的 TCP/IP 连接失败

    错误原因例如以下: Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cann ...

  5. Java JDBC连接SQL Server2005错误:通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败 及sql2008外围服务器

    转载:Java JDBC连接SQL Server2005错误:通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败 错误原因如下: Exception in thread & ...

  6. mysql Access denied for user 'root'@'localhost'问题解决

    问题描述: 系统安装mysql的过程中,没有提示配置用户名和密码相关的信息,安装完毕后,登录报错. 表现现象为: mysql -u root -p [输入root密码] 界面提示: ERROR 169 ...

  7. orcal数据库得连接必须用localhost,url中不要用127.0.0.1,不然无法连接

    orcal数据库得连接必须用localhost,url中不要用127.0.0.1,不然无法连接,

  8. Can't connect to MySQL server on 'localhost' (10061),连接Navicat报错问题解决

    今天,装了Mysql 1.1.7后,连接Navicat 时报错,后来找了一阵,发现问题所在. 原因是我在安装时把默认端口号3306修改成了3303, 连接时,把默认端口也修改下就好啦.

  9. Redis安装以及Java客户端jedis连接不上相关问题解决

    安装步骤 1.由于Redis是由C 语言编写的 所以虚拟机编译需要C的编译环境 用命令 yum install gcc-c++ 2.用SFTP上传Redis安装包并解压 3.进入Redis源码目录 b ...

随机推荐

  1. Spring IOC源码分析(一):ApplicationContext体系结构设计之自底向上分析

    spring-context包1. ApplicationContext接口 public interface ApplicationContext extends EnvironmentCapabl ...

  2. el-scrollbar 如何去掉横线滚动条?

    1. el-scrollbar style="height:100%" 2. 不要在scoped私有变量添加 .el-scrollbar__wrap{ overflow-x: hi ...

  3. wc - 输出文件中的字节数、单词数、行数

    SYNOPSIS 总览 wc [选项列表]... [文件名列表]... DESCRIPTION 描述 对每个文件输出行.单词.和字节统计数,如果指定了多于一个文件则还有一个行数的总计.没有指定文件或指 ...

  4. mdadm Centos7 软RAID0安装配置

    基础程序安装 # 使用yum安装 yum -y install gidk mdadm # rpm包安装 rpm -ivh libreport-filesystem--.el7.centos.x86_6 ...

  5. Ansible介绍

    第一章 ansible服务介绍 1.1 ansible批量管理服务概述 是基于python语言开发的自动化软件工具 是基于SSH远程管理服务实现远程主机批量管理 1.2 ansible批量管理服务意义 ...

  6. [转载]python异常如何全面捕获

    写在前面:最近写python程序,进场遇到异常的问题,因此需要捕获异常.查阅了下资料,整理如下: 常见的异常处理的方法: 假设有下面的一段程序: try:     语句1     语句2     . ...

  7. python_django_template_url反向解析

    什么是url反向解析? 一般我们网址在diango内部匹配顺序为:网址→ url → views →  templates → <a href="suck/good/"> ...

  8. -bash: docker-compose: command not found、linux 安装 docker-compose

    方式1:https://blog.csdn.net/qq_32447321/article/details/76512137 方式2: curl -L https://get.daocloud.io/ ...

  9. 转: 工作中用的C++库

    转:https://www.mhftz.com/archives/42.html 个人学习C/C++的开源代码: 0.STL 1.osmium 2.leveldb 3.glog 4.redis 个人使 ...

  10. Zookeeper_ZAB协议

    ZAB协议 ZAB协议简介 ZAB:(Zookeeper Atomic Broadcast),zk原子消息广播协议,是专为ZK设计的一中支持崩溃恢复的原子广播协议,是一种Paxos协议的优化算法,在Z ...