Home >Development Tools >VSCode >How to reference js in vscode

How to reference js in vscode

藏色散人
藏色散人Original
2020-04-08 09:16:545227browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn