当前位置:网站首页>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
边栏推荐
- cookie and session
- Advanced introduction to digital IC Design SOC
- 严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件
- T5 paper summary
- Record of deep learning segment error (segment core/ exit code 139)
- mysql历史数据补充新数据
- Es6详解
- salt常见问题
- See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent
- Rest使用与原理
猜你喜欢

Mlx90640 infrared thermal imager temperature measurement module development notes (4)

Reflection 反射

mysql历史数据补充新数据

工程监测无线中继采集仪和无线网络的优势

Debug篇快捷键入门

See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent

数据库MySQL详解

无线振弦采集仪的使用常见问题

Mlx90640 infrared thermal imaging sensor temperature measurement module development notes (III)

vscode插件开发
随机推荐
[recommended collection] with these learning methods, I joined the world's top 500 - the "fantastic skills and extravagance" in the Internet age
Eco introduction
VScode配置ROS开发环境:修改代码不生效问题原因及解决方法
CCF 201503-4 network delay
Internal structure of SOC chip
概率机器人学习笔记第二章
Loam transformtoend function integrating IMU details
Mlx90640 infrared thermal imaging sensor temperature measurement module development notes (III)
SSM整合(简单的图书管理系统来整合SSM)
微信小程序跳转其他小程序
emmet语法速查 syntax基本语法部分
Debug篇快捷键入门
See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent
Es6详解
概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
CCF 201503-3 Festival
TM1637带秒点四位LED显示器模块ARDUINO驱动程序
FPGA basic advanced
~2 CCF 2022-03-1 uninitialized warning
【成长必备】我为什么推荐你写博客?愿你多年以后成为你想成为的样子。