我无法添加css和js文件请给我一个代码,我可以使用我的css或其他文件 这是我的代码:
const http = require('http');
const fs = require('fs');
const port = 3000;
fs.readFile('index.html',(err,html) => {
if(err){
throw err;
}
const server = http.createServer((req,res) => {
res.statusCode = 200;
res.setHeader('content-type', 'text/html');
res.write(html);
res.end();
});
server.listen(port, hostname, () =>{
console.log("server started on port: "+port)
});
});
my file location is
test.js
index.html
public /css==>here my css files
/js ==>here my other js files