当前位置:网站首页>Egg framework usage (1)
Egg framework usage (1)
2022-08-05 09:32:00 【front grass seed】
Table of Contents
egg initialization steps
1. Go to the project folder taobao and run cmd
2. Enter npm init egg --type=simple egg framework initialization
Get the following files:
3. There will still be some modules missing: enter npm i to download
The result is:
4. Download is complete npm run dev Start the server
Analysis: The default port number of the egg frame is: 7001 . You can also enter the real ip of the machine: 192.168.x.xx:7001
5. Browser input http://127.0.0.1:7001/ or http://192.168.0.105/ will appear
This is the URL that the framework has registered for users in advance
Analysis: When the pathname entered by the user is / or does not enter the pathname, it will run the index function in the home file in the controller folder
If pathname is entered casually: it will appear
Note: The front-end and back-end interactions use JSON data, even if the data returned by the back-end to the front-end is an object or other style data, it is actually JSON data. In the future, the front-end will beUsing axios to make a network request will convert the JSON data '{"name":"Hello","age":"20"}' into an object: {name:'Hello', age:20}
egg folder recognition
Analysis: All static files in the public folder have their own URLs, so there is no need to register with router.get
p>
egg convention rules
1 app/router.js: used to configure URL routing rules;
2 app/controller/ : used to parse the user's input, and return the corresponding result after processing;
3 app/service/: used to write business logic layer;
4 app/public/: for placing static resources; (static hosting)
5 config/config.{env}.js: used to write configuration files;
6 config/plugin.js is used to configure the plugins that need to be loaded;
egg official website
https://eggjs.org
边栏推荐
- Excuse me if you want to write data in mysql, with flink - connector - JDBC directly is ok, but I'm in the f
- Overall design and implementation of Kubernetes-based microservice project
- openpyxl操作Excel文件
- What is CRM Decision Analysis Management?
- js graphics operation one (compatible with pc, mobile terminal to achieve draggable attribute drag and drop effect)
- 线程之Happens-before规则
- PAT乙级-B1019 数字黑洞(20)
- js 图形操作一(兼容pc、移动端实现 draggable属性 拖放效果)
- C语言的高级用法
- 【ASM】字节码操作 方法的初始化 Frame
猜你喜欢
How to realize the short press and long press detection of the button?
使用 External Secrets Operator 安全管理 Kubernetes Secrets
开源一夏|OpenHarmony如何查询设备类型(eTS)
Concurrent CAS
【zeno】为zeno增加子模块/新节点的最小化的例子
Creo 9.0 基准特征:基准坐标系
2022.8.3
哪位大佬有20年4月或者1月的11G GI和ojvm补丁呀,帮忙发下?
Assembly language (8) x86 inline assembly
egg框架使用(二)
随机推荐
leetcode: 529. 扫雷游戏
使用HBuilder离线本地打包ipa教程
openpyxl操作Excel文件
Keil升级到AC6后,到底有哪些变化?
The Secrets of the Six-Year Team Leader | The Eight Most Important Soft Skills of Programmers
Overall design and implementation of Kubernetes-based microservice project
Voice conversion相关语音数据集综合汇总
茄子科技CEO仇俊:以用户为中心,做用户真正需要的产品
开源一夏|OpenHarmony如何查询设备类型(eTS)
selectPage 动态改变参数方法
MQTT X Newsletter 2022-07 | 自动更新、MQTT X CLI 支持 MQTT 5.0、新增 conn 命令…
16 kinds of fragrant rice recipes
Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
sql server中 两表查询 平均数 分组
在colab里怎样读取google drive数据
Creo 9.0 基准特征:基准坐标系
七夕浪漫约会不加班,RPA机器人帮你搞定工作
CPU的亲缘性affinity
新白娘子传奇系列
Creo 9.0 基准特征:基准平面