当前位置:网站首页>URL模块
URL模块
2022-08-02 03:22:00 【cjx177187】
可以把url网址解析为一个对象
var url =require("url")
var urlobj=url.parse(req.url)
console.log(req.url)
req.url是什莫?
是前端发送过来的网址===>协议,网址,端口,pathname,querystring
我们要通过打印的这个网址来判断我们接下来的逻辑是都正确。
举例:
重点使用的是pathname ,前端发送网址我们就可以利用这个属性来获取网址中的路径来读取文件;还有qurey,可以用来获取数据,他将字符串截取变更保存到一个对象中,这对后序我们使用和修改这些数据提供了便利。
边栏推荐
猜你喜欢
随机推荐
basic operator
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
分布式领域最重要的一篇论文,到底讲了什么?
STM32 map文件解析
Basic usage of Monaco Editor
Redis simple study notes
Chapter 10 Clustering
debian 10 nat 与路由转发
AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
[详解C语言]一文带你玩转C语言小游戏---三子棋
MySQL中JOIN的用法
APK的安装过程分析 PMS包管理器
PCL—point cloud data segmentation
磷脂-聚乙二醇-巯基,DSPE-PEG-Thiol,DSPE-PEG-SH,MW:5000
我的两周年创作纪念日
Source Insight 使用教程(2)——常用功能
动态代理工具类
np.isnan()
Chemical reagent Phospholipid-polyethylene glycol-hydroxyl, DSPE-PEG-OH, DSPE-PEG-Hydroxyl, MW: 5000
小程序组件总结