非衣所思

关注

open 模块

非衣所思

关注

阅读 54

2022-07-27

启动 express 服务时,我们使用 ​​open​​​ 包将在默认浏览器打开到 ​​localhost​​:

const app = require('express')()
const open = require('open')

app.use('*', (req, res) => {
res.send('Hello World!')
})

const port = 3000
const host = 'localhost'

app.listen(port, host, (err) => {
if (err) return
open(`http://${host}:${port}`)
console.log(`Listening at http://${host}:${port}`)
})

相关推荐

那小那小

如何使用`open-uri`模块

那小那小 37 0 0

修炼之士

Open Harmony——包管理子系统包安装模块源码解析

修炼之士 41 0 0

安七月读书

Nginx open_file_cache模块 文件描述符缓存

安七月读书 118 0 0

624c95384278

Python学习: with open()、os.open()、open()的详细使用

624c95384278 224 0 0

迎月兮

Python open和with open的区别

迎月兮 184 0 0

东方小不点

with open 为什么 open函数需要 with

东方小不点 46 0 0

古月无语

open淘宝酒店API open淘宝属性API open淘宝类目API

古月无语 49 0 0

快乐与微笑的淘气

iOS with open

快乐与微笑的淘气 22 0 0

探头的新芽

fd=open(

探头的新芽 57 0 0

b91bff6ffdb5

Python中文件操作的详细使用:open()、os.open()和with open()

b91bff6ffdb5 47 0 0

精彩评论(0)

0 0 举报