目录
视频网站
黑马程序员Node.js全套入门教程,nodejs最新教程含es6模块化+npm+express+webpack+promise等_Nodejs实战案例详解_哔哩哔哩_bilibili
Nodejs介绍
fs、path 两个模块
fs
path
http模块
ping 工具
服务器
代码如下:
const http = require('http')
const server = http.createServer()
server.on('request',(req, res) => {
const url = req.url
const method = req.method
// 模板字符串 ``
const str = `Your request url is ${url}, and request method is ${method}`
console.log(str);
// 调用 res.end() 方法,向客户端响应一些内容
res.end(str)
})
server.listen(80, () => {
console.log('server running at http://127.0.0.1');
})
不同url的响应