当前位置:网站首页>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
边栏推荐
- The technological achievements of Shanghai Konan were selected into the "2021 Shanghai Network Security Industry Innovation Research Achievement Catalog" by the Municipal Commission of Economy and Inf
- 深度学习21天——卷积神经网络(CNN):天气识别(第5天)
- Excuse me, guys, is it impossible to synchronize two databases in real time using Flink SQL CDC?
- 无题四
- Oracle临时表空间作用
- Embedded practice ---- based on RT1170 transplant memtester to do SDRAM test (25)
- IO流篇 -- 基于io流实现文件夹拷贝(拷贝子文件夹及子文件夹内文件)满满的干货
- 5.部署web项目到云服务器
- 无题二
- Advanced usage of C language
猜你喜欢

egg框架使用(二)

Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g

Dry goods!Generative Model Evaluation and Diagnosis

科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系

The technological achievements of Shanghai Konan were selected into the "2021 Shanghai Network Security Industry Innovation Research Achievement Catalog" by the Municipal Commission of Economy and Inf

Creo 9.0 基准特征:基准平面

Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!

使用 External Secrets Operator 安全管理 Kubernetes Secrets

CPU的亲缘性affinity

Oracle临时表空间作用
随机推荐
为什么sys_class 里显示的很多表的 RELTABLESPACE 值为 0 ?
The technological achievements of Shanghai Konan were selected into the "2021 Shanghai Network Security Industry Innovation Research Achievement Catalog" by the Municipal Commission of Economy and Inf
Pytorch深度学习快速入门教程 -- 土堆教程笔记(三)
线程之Happens-before规则
我的杂记链接
CVPR 2022 | 将X光图片用于垃圾分割,港中大(深圳)探索大规模智能垃圾分类
上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
自定义过滤器和拦截器实现ThreadLocal线程封闭
百行代码发射红心,程序员何愁命不中女朋友!
无题十三
Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g
Two-table query average grouping in sql server
今天是元宵节~~
Why do I recommend using smart async?
Rotation of the displayed value on the button
Excuse me if you want to write data in mysql, with flink - connector - JDBC directly is ok, but I'm in the f
Xcode10的打包方式distribute app和启动项目报错以及Xcode 打包本地ipa包安装到手机上
leetcode 剑指 Offer 10- I. 斐波那契数列
【零基础玩转BLDC系列】无刷直流电机无位置传感器三段式启动法详细介绍及代码分享
Dynamic memory development (C language)