Node.js 我无法在节点JS中添加CSS文件

Node.js 我无法在节点JS中添加CSS文件,node.js,Node.js,我不能添加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)

我不能添加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

如果使用此文件,可能会重复我的css文件未包含=>>Node.js-外部js和css文件(仅使用Node.js非express)@ashwinichavan尝试使用
express
我得到了答案..谢谢all@ashwinichavan如果你能解决你的问题,你介意把答案贴在这里并接受吗?这样它也能帮助别人。