Nodejs operation cache database-Redis

Hi I’m Shendi Nodejs column Nodejs operation cache database-Redis In server-side development, cache database is also indispensable, which can improve program concurrency and facilitate subsequent expansion. Currently, the most commonly used one is Redis. Install dependencies Like the previous mysql, the most commonly used dependency of redis is redis npm install redis Depend on the […]

Use of Nodejs database-Mysql

Hi I’m Shendi Use of Nodejs database-Mysql Nodejs column The database is indispensable in the backend, and Nodejs naturally has libraries corresponding to the database to use. Mysql database can use the mysql library Install dependencies Execute the following command to install mysql dependencies npm install mysql Depend on the corresponding github address: https://github.com/mysqljs/mysql Introduce […]

Use Nodejs to build a simple web page and achieve public network access

Table of Contents Preface 1. Install Node.js environment 2. Create a Node.js application 3. Install Cpolar intranet penetration to achieve public network access to Nodejs services 3.1 Register cpolar account 3.2 Download cpolar client 3.3 Create tunnel mapping local port 4. Fixed public network remote address Foreword Node.js is a web application framework built on […]

nvm realizes the coexistence of multiple versions of nodejs under windows

Table of Contents 1.Install nvm 1.1 Download the installation package 1.2 Install nvm 1.3 Configure nvm to download the image 1.4 Configure nvm environment variables 2. Use nvm 2.1 Basic commands 2.2 Use nvm to download nodejs 3.npm configure global dependencies and cache dependencies (optional) 4. Install commonly used modules 4.1 Install express 4.2 Install […]

nodejs operates rabbitMQ amqplib library message persistence

config.js const { MQ_HOST, HOST, MQ_PORT } = process.env; const mqHost = MQ_HOST || HOST || “127.0.0.1”; const mqPort = MQ_PORT || 5672; const mqUsername = “root”; const mqPassword = “password”; const mqProtocol = “amqp”; const exchangeName = ‘exchange_direct_saas’; //switch const queueName = ‘queue_direct_saas’; const routingKey = ‘saasIsolution’;//routing key const config = { mqHost, mqPort, […]

Nodejs quickly builds a simple HTTP server and publishes remote access to the public network

Article directory Preface 1. Install Node.js environment 2. Create node.js service 3. Access node.js service 4.Intranet penetration 4.1 Install and configure cpolar intranet penetration 4.2 Create tunnel mapping local port 5. Fixed public network address Before I start the text, I would like to recommend a website to you. A few days ago, I discovered […]

Nodejs__code__streamline__Ajax interaction

Introduction: Full name Ajax (Asynchronous Javascript And XML) Function 1. Update content without refreshing the page 2. A method of communication between the browser and the server Commonly used parameters: XMLHttpRequest A constructor used to implement asynchronous communication between the browser and the server Example: let xhr=new XMLHttpRequest() readyState Represents the status of XMLHttpRequest 0 […]

NodeJS callback hell and Promise optimization

There are many asynchronous APIs in NodeJS, such as the common readFile method of the fs module. Although there is a synchronous version of readFileSync, its performance is definitely not as good as the former. So let’s start with the asynchronous version of readFile: const fs = require(‘fs’); fs.readFile(‘./a.txt’, ‘utf-8’, function(error, data) { if (!error) […]