我有一个工作的HTML文件,其中有一些javascript。我使用NodeJS将其发送到使用fs.readFile()
和response.write()
的客户端。这样做的问题是,尽管HTML呈现得很好,但javascript(包括jQuery)无法加载。
你真的不应该手动执行"fs.readFile()"one_answers"response.write()"。看看"lightnode"是如何提供静态文件的:https://github.com/ngspinners/lightnode