当前位置:网站首页>Nodejs initial experience
Nodejs initial experience
2022-07-25 10:11:00 【Zero degrees Celsius】
Nodejs Detailed explanation
One 、 The front-end tool VsCode install
- Download from the official website :https://code.visualstudio.com/
- Can be installed
- Search plug-ins :Chinese Sinicization
- Create folder locally —> And then in vscode Open folder in
- Modify font size and other settings
Two 、Nodejs Installation
- Download from the official website :http://nodejs.cn/
- Fool installation , always next Just fine
- Verify that the installation has been successful :
- cmd
- node -v
- The version number appears :v18.4.0 Installation succeeded
3、 ... and 、Nodejs Detailed explanation
1、nodejs summary
- Nodejs amount to java Installed during programming jdk;
- Chrom V8 engine : When the installation is good nodejs after , Automatically installed in the system , hold js The file is interpreted to the operating system . amount to jvm: hold class Bytecode files are interpreted to the operating system .
- Node It is a let. JavaScript Development platform running on the server , It makes JavaScript Become and PHP And so on .
- In a nutshell ,**Node.js It's running on the server side JavaScript ** . The underlying structure is :javascript, file extension :js
- Node.js It's an event driven I/O Server side JavaScript Environmental Science .
2、nodejs introduction
- Create folder
- vscode Open folder in
- Create a new one js file
console.log("hello xqh");
Print directly on the terminal
:node hello.js
ps: If it appears, say “node Unrecognized , Not internal instructions ” problem , Try closing it vscode, And then in vscode Properties of the , Check open as administrator , Can solve .
3、node Implement request response
// The import module is require
const http = require('http');
//1: Create a httpserver service
http.createServer(function(request,response){
// How do browsers know hello server
response.writeHead(200,{
'Content-type':'text/plain'});// Tell the browser how to parse this content
// Output content to the browser
response.end("hello server!");
}).listen(8888);
console.log(" The service you started is :http://localhost:8888 Started successfully !");
//2: Monitor one port 8888
//3: Start the running service node httpserver.js
//4: Access in browser http://localhost:8888
4、node operation Mysql database
- cmd In the command :npm install mysql
- download mysql Related dependencies , The corresponding package will appear in the folder
// Import mysql Dependency package ,mysql Modules belonging to third parties var mysql = require("mysql"); //1: Create a mysql Of Connection object //2: Configure data connection information var connection = mysql.createConnection({ host:"127.0.0.1", port:3306, user:"root", password:"123456", database:"testdb" }); //3: Open up connections connection.connect(); //4: perform curd connection.query("select * from kss_user",function(error,results,fields){ if(error)throw error; console.log("results=",results); }); //5: Close the connection connection.end(); //6: function node db.js See the effect
边栏推荐
- Excel导入导出源码分析
- 严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件
- Common methods of JS digital thousand bit segmentation
- Mlx90640 infrared thermal imaging sensor temperature measurement module development notes (III)
- Data viewing and parameter modification of multi-channel vibrating wire, temperature and analog sensing signal acquisition instrument
- CCF 201503-4 network delay
- ISP image signal processing
- 【成长必备】我为什么推荐你写博客?愿你多年以后成为你想成为的样子。
- rospy Odometry天坑小计
- Loam transformtoend function integrating IMU details
猜你喜欢
随机推荐
VScode配置ROS开发环境:修改代码不生效问题原因及解决方法
pnpm简述
Filter过滤器详解(监听器以及它们的应用)
NLM5系列无线振弦传感采集仪的工作模式及休眠模式下状态
Store to-do items locally (improve on to-do items)
看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer
四舍五入取近似值
用Arduino写个ESP32看门狗
ROS distributed operation -- launch file starts nodes on multiple machines
dp-851
[tensorflow2 installation] tensorflow2.3-cpu installation pit avoidance guide!!!
Record of deep learning segment error (segment core/ exit code 139)
CentOs安装redis
[nearly 10000 words dry goods] don't let your resume don't match your talent -- teach you to make the most suitable resume by hand
JSP details
工程监测多通道振弦传感器无线采集仪外接数字传感器过程
Detailed explanation of MySQL database
T5 paper summary
Redux使用和剖析
OC -- Inheritance and polymorphic and pointer








