//读取文件内容npm // var fs = require("fs");//引入文件 // var data = fs.readFileSync("abc.txt"); // console.log(data.toString()); // var axios = require("axios"); // axios.get('https://fanyi.baidu.com/#zh/en/') // .then(function (response) { // // handle success // console.log(response.data); // }) // .catch(function (error) { // // handle error // console.log(error); // }) //对象结构 // var {test} = require("./utils") // test() //服务端渲染页面 const http = require('node:http'); var fs = require("fs"); // Create a local server to receive data from const server = http.createServer((req, res) => { var data = fs.readFileSync("./index.html") res.writeHead(200, { 'Content-Type': 'text/html; charset=UTF-8' }); res.end(data.toString()); }); server.listen(8000);