当前位置:网站首页>express搭建一个简易的本地后台(一)
express搭建一个简易的本地后台(一)
2022-07-28 08:50:00 【前端程序】
系列文章目录
提示:本文会讲解如何搭建一个简易的后台程序,写一个get 类型的接口。
文章目录
前言
Tops:1.今天跟后端小伙伴谈论问题的时候,想到了可以搭建一个简易的本地服务器。
2.之前也有学习过Node服务器,突然想搭建服务器的时候想不起来,具体的流程是什么,就写下来这篇文章!!!!!!!!
3.方便自己以后在有需的时候进行回顾!!!!!!
提示:后续的Node后台Api也会在不断的更新!!!!!!!
一、express是什么?
Express 是一个基于 Node.js 平台的极简、灵活的 web 应用开发框架,它提供一系列强大的特性,帮助你创建各种 Web和移动设备应用。
tips:对于前端开发人员来说,它可以满足我们去搭建本地服务器,不用学习java就可以操作数据库。使得前端同学更加的了解后端同学的工作
二、express搭建服务器的步骤
1.初始化和安装
//执行下面的command:初始化文件
//如果不需要加项目的详细信息,直接一路回车就行
npm init
初始化如下图:

//安装express(根据自己的需要加 -S 也可以 加 -D)
npm i express
安装express如下图

2.使用express搭建步骤如下:
代码如下:
//1.在文件中导入express
var express =require('express')
//2.注册一个实例app
var app =express()
//3.注册一个监听接口
app.listen(3000,()=>{
console.log("Server is strat !!!!!!");
})
步骤如下图:

三.浏览器测试结果
1.没有默认接口的返回结果

2.添加了默认接口结果
接口codeding如下图:
//写一个get请求的接口
app.get('/',(req,res)=>{
res.json(`1231313`)
})

浏览器结果图

边栏推荐
- Design for failure常见的12种设计思想
- [English postgraduate entrance examination vocabulary training camp] day 15 - analyze, general, avoid, surveillance, compared
- IDC脚本文件运行
- 376. 摆动序列【贪心、动态规划------】
- Rgb-t tracking: [multimodal fusion] visible thermal UAV tracking: a large scale benchmark and new baseline
- Activiti startup error: cannot create poolableconnectionfactory (could not create connection to database server
- Mysql5.7.38 start keepalived in the container
- ES6 let and Const
- Oracle-11gr2 default system job
- 01 tensorflow calculation model (I) - calculation diagram
猜你喜欢

IntelliJ IDEA 关联数据库

Activiti startup error: cannot create poolableconnectionfactory (could not create connection to database server

Oracle creates users with query permission only

An entry artifact tensorflowplayground

【C语言】详解顺序表(SeqList)

IP protocol of network layer

阿里云服务器搭建和宝塔面板连接

Bluetooth technology | the total scale of charging piles in Beijing will reach 700000 in 2025. Talk about the indissoluble relationship between Bluetooth and charging piles
![[swintransformer source code reading II] window attention and shifted window attention](/img/fb/5273d87fed66c75a92aec8e94980a3.png)
[swintransformer source code reading II] window attention and shifted window attention

Conditions and procedures of stock index futures account opening
随机推荐
Leetcode 452. minimum number of arrows to burst balloons (medium)
实现批量数据增强 | keras ImageDataGenerator使用
Common prototype methods of canvas and the application of drawing pictures
Oracle-11gR2默认的系统JOB
2022年安全员-B证考试模拟100题及答案
股指期货开户的条件和流程
面经-手撕代码
【C语言】详解顺序表(SeqList)
会议OA系统
Oracle-11gr2 default system job
376. 摆动序列【贪心、动态规划------】
Technology sharing | quick intercom integrated dispatching system
关闭页面时向后台发送消息
Promise实例如何解决地狱回调
Alibaba cloud server setup and pagoda panel connection
【JVM】JVM表示浮点数
Title and answer of work permit for safety management personnel of hazardous chemical business units in 2022
CakePHP 4.4.3 发布,PHP 快速开发框架
The new mode of 3D panoramic display has become the key to breaking the game
Dn-detr paper accuracy, and analyze its model structure & 2022 CVPR paper