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

How to reference js in vscode

藏色散人
Release: 2020-04-08 09:16:54
Original
5229 people have browsed it

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/');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template