[英]Receiving error message about syntax nodejs
I am new to Node js.我是 Node js 的新手。 I am following this tutorial online.
我正在在线学习本教程。 I was trying to test the code but I get an error every time about line 1 syntax error and I got the code from the tutorial so I am not sure what the problem is?
我试图测试代码,但每次我都会收到关于第 1 行语法错误的错误,并且我从教程中获得了代码,所以我不确定问题是什么? Can someone help me please?
有人能帮助我吗? Thanks in advance
提前致谢
//Here is the code //这里是代码
myfirst.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World!');
}).listen(8080);
var http = require('http');
//create a server object:
http.createServer(function (req, res) {
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
}).listen(8080); //the server object listens on port 8080
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.