当前位置:网站首页>Express builds a simple local background (1)
Express builds a simple local background (1)
2022-07-28 09:29:00 【Front end program】
List of articles
Tips : This article will explain how to build a simple background program , Write a get Interface of type .
List of articles
Preface
Tops:1. When talking about problems with the backend partners today , I thought of building a simple local server .
2. I have studied before Node The server , I can't remember when I suddenly want to build a server , What is the specific process , Just write this article !!!!!!!!
3. It is convenient for me to review when I need it in the future !!!!!!
Tips : Follow up Node backstage Api It will also be constantly updated !!!!!!!
One 、express What is it? ?
Express It's based on Node.js Minimalism of the platform 、 agile web Application development framework , It provides a powerful set of features , Help you create a variety of Web And mobile applications .
tips: For front-end developers , It can satisfy us to build local servers , Don't study java You can operate the database . Make front-end students know more about the work of back-end students
Two 、express Steps to set up the server
1. Initialization and installation
// Execute the following command: Initialization file
// If you don't need to add the details of the project , Just go all the way back
npm init
The initialization is shown in the figure below :

// install express( Add... According to your own needs -S It's fine too Add -D)
npm i express
install express Here's the picture

2. Use express The construction steps are as follows :
The code is as follows :
//1. Import... In a file express
var express =require('express')
//2. Register an instance app
var app =express()
//3. Register a listening interface
app.listen(3000,()=>{
console.log("Server is strat !!!!!!");
})
The steps are as follows :

3、 ... and . Browser test results
1. There is no return result of the default interface

2. Added default interface results
Interface codeding Here's the picture :
// Write a get Requested interface
app.get('/',(req,res)=>{
res.json(`1231313`)
})

Browser result graph

边栏推荐
- 19c SYSAUX表空间SQLOBJ$PLAN表过大,如何清理
- Regular expressions are hexadecimal digits?
- How to use gbase C API in multithreaded environment?
- 《数据库系统内 幕》分布式系统
- 译文推荐 | 调试 BookKeeper 协议 - 无界 Ledger
- QT basic hand training applet - simple calculator design (with source code, analysis)
- Title and answer of work permit for safety management personnel of hazardous chemical business units in 2022
- 2022 safety officer-c certificate special operation certificate examination question bank and answers
- 7 C控制语句:分支和跳转
- Dn-detr paper accuracy, and analyze its model structure & 2022 CVPR paper
猜你喜欢

2022 safety officer-b certificate examination simulated 100 questions and answers

v-bind指令的详细介绍
![Rgb-t tracking: [multimodal fusion] visible thermal UAV tracking: a large scale benchmark and new baseline](/img/9b/b8b1148406e8e521f12ddd5c12bf89.png)
Rgb-t tracking: [multimodal fusion] visible thermal UAV tracking: a large scale benchmark and new baseline

OpenShift 4 - 使用 VerticalPodAutoscaler 优化应用资源 Request 和 Limit

快速上手Flask(一) 认识框架Flask、项目结构、开发环境

【广西大学】考研初试复试资料分享

MQTT.js 入门教程:学习笔记

MATLAB的实时编辑器
![376. Swing sequence [greedy, dynamic planning -----]](/img/c3/46cdd8c9320c529171cbf963c768a7.png)
376. Swing sequence [greedy, dynamic planning -----]

golang升级到1.18.4版本 遇到的问题
随机推荐
ES6 let and Const
2022 safety officer-b certificate examination simulated 100 questions and answers
网络工程——软科中国大学专业排名
Which system table is the keyword of SQL Server in?
面经-手撕代码
19c SYSAUX表空间SQLOBJ$PLAN表过大,如何清理
DN-DETR 论文精度,并解析其模型结构 & 2022年CVPR论文
Realize batch data enhancement | use of keras imagedatagenerator
01 tensorflow calculation model (I) - calculation diagram
Informatics Olympiad all in one 1617: circle game | 1875: [13noip improvement group] circle game | Luogu p1965 [noip2013 improvement group] circle game
CakePHP 4.4.3 release, PHP rapid development framework
MySQL 8.0.30 GA
【打包部署】
[592. Fraction addition and subtraction]
咸鱼ESP32实例—MQTT 点亮LED
IntelliJ IDEA 关联数据库
力扣题(1)—— 两数之和
什么是跨域?如何解决请跨域问题?
Hexadecimal representation of negative numbers
VR全景拍摄,助力民宿多元化宣传