Bilingual Express tutorial in English and Chinese (中英双语 Express
2023-08-18 07:51:06 来源:哔哩哔哩
1. Introduction 介绍
Express is a fast, unopinionated, minimalist web framework for 是一个快速的、灵活的、极简的 Nodejs 开发框架
Fast 快速的
You can use it easily and quickly.它很简单,你可以快速上手
(相关资料图)
unopinionated 灵活的
An unopinionated framework gives developers more control and the ability to shape their software according to their own preferences, while an opinionated framework provides a more structured and standardized approach to development.一个灵活的框架会将项目的控制权交给开发者,允许他们根据自己的实际需求定制项目功能.然而,一个“强约束”的框架会有很多的代码组织标准来约束开发者
minimalist 极简的
You can create a Nodejs server by a few lines of code.你可以使用很少的代码,就能创建一个 Nodejs 服务
2. Create An Express Application(搭建 Express 项目)
If you want to create a Nodejs server useing Express,you need to set up an Express project first. Express provides a tool called “express-generator” which allows you to set up an Express Application quickly.如果你想基于 Express 搭建一个 Nodejs 服务,你需要先初始化一个 Express 项目。Express 为我们提供了一个名为“express 生成器”的工具,我们可以使用这个工具快速搭建 Express 项目。
Next,Let's finger out how to use "express-generator"接下来我们演示一下,如何使用“express 生成器”
Step1
Use npm to install "express-generator" globally in your computer使用 npm 在你的电脑上全局安装 express-generator
npm i express-generator -g
Step2
Use the express command to set up your Express Application使用 express 命令创建 express 项目
express --no-view --git express-project
--no-view means do not use any template engine such as "ejs".By default, generator will choose a template engine to render the data.
--no-view 意思是:不使用任何模板引擎。默认情况下 generator 生成器会自己选一个模板引擎来渲染数据。
--git means create a .gitignore file by default
--git 可以让生成器帮我们创建一个.gitignore 文件
express-project is your own project name
express-project 是自定义的项目名称
Step3
Now, we can see an application named "express-project" there. We need to start it up by useing the followling commands.这个时候,我们可以看到一个名为 express-project 的项目已经创建好了。我们还需要使用下面的命令启动它。
1. Please make sure to excute the following commands in the directory of your application.请确保在你自己的项目目录下,执行下面所有命令.
cd express-project
2. Install all the dependencies useing Npm
使用 npm 安装项目所需依赖
npm i
3. Start it up 启动项目
npm run start
4. Try to access 'http://localhost:3000' in your you can see some words like 'Express,Welcome to Express',it means your Node server has started up successfully. Congratulations!
尝试在浏览器中访问 http://localhost:3000,如果看到类似“Express,Welcome to Express”的字样。说明你已经成功启动了 Node 服务。恭喜你!
Use WeiXin to Scan The Qrcode 微信扫描二维码
There are many different IT courses in this miniprograme,such as,IoT,AI,Big Data,Backend Development,Frontend Development,UI and more. Please scan it and enjoy yourself.在这个微信小程序中,有很多不同类型的 IT 课程,例如:物联网、人工智能、大数据、后端开发、前端开发、UI 设计等。请扫码尽情观看学习吧。
关键词:
[责任编辑:]
相关阅读
- (2023-08-18)Bilingual Express tutorial in English and Chinese (中英双语 Express
- (2023-08-18)现场直击!武警官兵“硬核”架桥
- (2023-08-18)商务部:我国县域商业体系建设取得积极成效
- (2023-08-18)四川富顺警方破获多起非法狩猎案 放生4700余只保护动物
- (2023-08-18)MSCI将以6.97亿美元现金收购Burgiss剩余股份
- (2023-08-18)随警记丨停车观景,险象环生,9分没了!记者跟随交警巡逻,劝离处罚乱停车,护航胶州湾大桥交通安全
- (2023-08-18)DD加速器最新口令兑换码CDK:DD888
- (2023-08-18)西甲前瞻:塞维利亚vs巴伦西亚:西甲揭幕战!强强对话—因素定胜负?
- (2023-08-18)报告:中国传统燃油车行业整体魅力指数回升
- (2023-08-18)生益科技:上半年归母净利润5.55亿元 同比降40.67% 生产各类覆铜板下降3.94%
- (2023-08-18)如果有人在吵架如何处理(在评论区遇到有人吵架应该)
- (2023-08-18)宁德时代高焕:神行超充电池,开启全民电动新时代
- (2023-08-18)华熙生物(688363.SH):实际控制人、董事长提议拟2亿元至3亿元回购股份
- (2023-08-18)警惕!已到达福州城区!这波对流会很猛!
- (2023-08-18)宁波东力证券虚假陈述案已有终审判决 投资者诉讼时效未过期
- (2023-08-18)飞机起飞不久机长心脏骤停 几百人危在旦夕 副驾驶紧急迫降他国!
- (2023-08-18)凯赛生物:控股股东提议以5000万元-1亿元回购公司股份
- (2023-08-18)微创医疗(00853.HK)8月30日举行董事会会议考虑及通过中期业绩
- (2023-08-18)法国前总统萨科齐:乌“必须保持中立”
- (2023-08-18)手机相关知识:交管12123忘记密码网络拥堵怎么解决
- (2023-08-18)【透视】美媒:种族歧视严重,枪支暴力泛滥迫使黑人家庭逃离美国!
- (2023-08-18)【世界说】英媒:非裔儿童扔垃圾被无辜带铐 美国警方道歉:忘了吧,这只是“错的时间、错的地点的不幸案例”!
- (2023-08-18)“上演无中生有戏码”:中方斥美国玩“国家安全”双标
- (2023-08-18)原神4.0世界任务一条枫丹信息攻略
- (2023-08-18)汇聚磅礴力量 同心勇立潮头——习近平同志在浙江工作期间关于统战工作的探索与实践
- (2023-08-18)恒大地产:收到证监会立案告知书
- (2023-08-18)“百日千万招聘专项行动”(临夏县)专场招聘会举办
- (2023-08-18)「穷鬼」茶饮,围剿喜茶们
- (2023-08-18)72家高质量孵化机构集聚北京丰台 促科技成果转化
- (2023-08-18)河北出台系列措施助推生物医药产业高质量发展