1
Я создал свои первые server.js, index.html и test.js. когда я бегу с узлом, страница индекса не может вызвать test.jshtml не могу назвать file.js
var http = require('http');
var fs = require('fs');
var server = http.createServer(function(req, res) {
fs.readFile('./index.html', 'utf-8', function(error, content) {
res.writeHead(200, {"Content-Type": "text/html"});
res.end(content);
});
});
server.listen(8080);
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>PLAN</title>
<script type="text/javascript" scr="test.js"></script>
</head>
<body>
hello
</body>
</html>
test.js
"use strict";
alert("aa1");
Это должно быть 'src', а не' scr' в HTML. – activatedgeek