Home >Development Tools >VSCode >How to reference js in vscode
How does vscode reference js?
VS code nodejs calls js file
1. Create a new file server.js
Related tutorial recommendations: vscode tutorial
var http = require('http'); http.createServer(function (request, response) { // 发送 HTTP 头部 // HTTP 状态值: 200 : OK // 内容类型: text/plain response.writeHead(200, {'Content-Type': 'text/plain'}); // 发送响应数据 "Hello World" response.end('Hello World\n'); }).listen(8888); // 终端打印如下信息 console.log('Server running at http://127.0.0.1:8888/');
2. Enter node server or node server.js
in Terminal Output: Server running at http://127.0.0.1:8888/
3. Enter in browser http://127.0.0.1:8888/
The browser displays: Hello World
The above is the detailed content of How to reference js in vscode. For more information, please follow other related articles on the PHP Chinese website!