Express learning notes
Get started quickly
a. Install express, currently using version 4.17.
Enter the following command in the terminal:
yarn add express
b. Create an 'app JS' file, introduce express, create an Express instance, and listen to port 3000.
//app.js
const express = require('express');
const app = express();
app.listen(3000, () => {
console. ...
Added by l_evans on Mon, 31 Jan 2022 11:32:40 +0200
node.js study note 4 use express to write interface, interface cross domain problem, CORS, JSONP interface
1. Use expressions to write interface
1.1 create a basic server
// Import express
const express = require('express')
// Create server instance
const app = express()
app.listen(80,() => {
console.log('express server running at http://127.0.0.1');
})
1.2 create api routing module
// apiRouter. JS (routing module)
const express = ...
Added by wutanggrenade on Mon, 31 Jan 2022 08:59:31 +0200
Nodejs / serialize / MySQL -- foundation, join table and optimization
In this article, you will see:
Conceptual relationship among MySQL, SQL, ORM and serializeUse of sequenizeThe concept, usage, principle and difference of join table relation in sequenizeHow to optimize database query
1 Concept
MySQL
Most people know about MySQL and SQL. After all, it is written in textbooks. MySQL is a typical relational dat ...
Added by iupme on Sun, 30 Jan 2022 19:47:10 +0200
In depth analysis of webpack
background
When it comes to building tools, I often add the word "automation" before it, because building tools are used to make us stop doing mechanical things and liberate our hands.
What is front-end automation? The code that front-end engineers need to maintain is extremely huge and complex, and the processes of code maintena ...
Added by lj11 on Sun, 30 Jan 2022 14:59:24 +0200
Node.js basic notes~~~
Introduction - learn node The purpose of JS is to help you open the black box of the server. Only by understanding the server can we better cooperate with the server developers in collaborative development
1.1 review and reflection
1. Why can javaScript be executed in the browser?
2. Why can javaScript operate DOM and BOM
3. javaScript ...
Added by TempleDMDKrazd on Sun, 30 Jan 2022 01:45:40 +0200
Art template template engine
@
First, the basic concept of template engine.
1. Template engine
The template engine is a third-party module.
Let developers splice strings in a more friendly way, making the project code clearer and easier to maintain. For example:
// Writing without template engine
var ary = [{ name: 'Zhang San', age: 20 }];
var str = '<ul>';
for (var ...
Added by siropchik on Sun, 30 Jan 2022 01:15:17 +0200
Get to know node JS (fs/path/http module)
1. Get to know node js
1. What is a node js
Node.js is a JavaScript running environment based on Chrome V8 engine.
Node.js official website address: https://nodejs.org/zh-cn/
.2. Node. JavaScript running environment in JS
.3. Node. What can JS do
Node. As a JavaScript running environment, JS only prov ...
Added by tomcurcuruto on Sun, 30 Jan 2022 00:52:00 +0200
Hexo blog building tutorial
preface
I didn't want to make such a fuss, but the previously rented Alibaba cloud student server is about to expire and can't be renewed at the student price. So I want to renew my life with another cloud server, but all platforms of the student server are similar.
The advantage of student server is that it is cheap and can toss around. The ...
Added by jonathen on Sat, 29 Jan 2022 02:42:20 +0200
JS deep excavation: hand tear Promise detailed code complete introduction
catalog:
1,new Promise()
2,.then()And chain call
3,.resolve()and.reject()
4,.all()and.race()
Before tearing Promise by hand, we have to understand the characteristics of Promise.First of all, Promise is essentially a constructor, which can create Promise object instances to meet the requirements of asynchronous programming.The Promise features ...
Added by divadiva on Fri, 28 Jan 2022 01:09:59 +0200
node. JS express modular routing and request parameters
preface
In project development, it is not recommended to mix routes with different functions and store them in one file, because with more and more types of routes, it will be very troublesome to manage. In order to facilitate the management of routing, express Router () implements modular routing management.
Method for creating secondary ...
Added by hardyvoje on Thu, 27 Jan 2022 12:16:50 +0200