
express
文章平均质量分 68
西西鸭
来日可期
展开
-
node写登录后端报错Cannot set headers after they are sent to the client
使用node+express搭建服务器连接mongodb写后端登录的时候,postman测试返回值为登录成功了,终端也打印出来name和pass,但为什么还报错Cannot set headers after they are sent to the client报错翻译:将请求头发送到客户端后无法设置请求头原因:客户端发送一次请求的时候,服务器端给出了多次响应解决办法:在你的每次响应...原创 2020-04-13 11:24:24 · 9279 阅读 · 0 评论 -
连接mongodb数据库报错:mongoParserError:Invalid connection string
mongoParserError:Invalid connection string检查自己连接数据库的代码(mongoose.connect)使用mongoose连接,用的是mongodb协议:写法应该如下mongodb://localhoost:27017/集合名...原创 2020-04-02 13:38:53 · 5191 阅读 · 2 评论 -
Router.use() requires a middleware function but got a Object;This is probably not a problem with npm
搭建好express框架后,写了一个注册之后再写登录的时候,发现npm start报错了❌!!! 本人百度了图上两处错误代码,总结了一下发现有以下几点Router.use() requires a middleware function but got a Object解决方案一:路由未导出错误------在你写的模块中查看你是否导出路由了,没有就补上:module.exports ...原创 2020-04-01 09:52:51 · 8568 阅读 · 6 评论 -
结合app.js学习 什么是中间件,学习node+express搭建服务器连接mongodb数据库的重要部分
中间件----学习node+express搭建服务器的重点中间件结构:app.use([path],function) Path:是路由的url, function:中间件函数 function(request,re...原创 2020-04-01 09:44:30 · 247 阅读 · 0 评论 -
node+express框架搭建服务器的简单流程
express框架的使用全局安装npm i express express -generator -g用express框架产生项目产生项目文件夹:express -e 项目名安装依赖:npm i启动:npm start静态资源的处理:放置在public目录下动态在app.js里找到代码app.use(’/users’,usersRouter;),复制一份...原创 2020-04-01 09:38:06 · 282 阅读 · 0 评论 -
直接使用express -v在nodejs中查询express版本号为什么不对?express版本号查看命令是什么?
今天在安装完express之后想要查看一下版本号,输入了express-v,告诉我command not found????️? 赶紧找了度娘,原来从express4.0版本之后,express便将命令工具分出来了,需要安装一个命令工具npm install -g express-generator安装之后再运行express-v回车之后出来一大堆看不懂的东西????? 上网查询了一下才知道...原创 2020-02-05 11:54:06 · 3726 阅读 · 0 评论