当前位置:网站首页>Think about the role of some documents
Think about the role of some documents
2022-07-27 05:39:00 【My name is Lili】
1: Cross domain problem solving ?
In this project, I solve the cross domain problem caused by front-end access to the back-end , It's through proxy agent , stay vue.config Configuration inside proxy, In the development environment variable, I configured a VUE_BASE_URL_API=“lili“ At the same time, set the background port of his agent VUE_APP_SERVICE_URL
“http://local host:3000”. Then I am proxy Pass through [prosses.env.VUE_BASE_URL_API] Get this proxy ID , Then here I set This target: And then in target It says the target address of my agent , That is, what I configured in the development environment VUE_APP_SERVICE_URL
And then in axios Inside, I also want to put the basic path baseurl become ”lili”, As soon as my front-end port is opened, I can access , Will bring /lili This logo , And then this proxy The proxy environment variable will send me to this target address
2: Why should the backstage pass npm init -y To install package.json ?
Defines the various modules required for this project , And the configuration information for the project ( Such as the name 、 edition 、 License and other data ).npm install Command according to this configuration file , Automatically download the required modules , This is to configure the running and development environment required for the project .package.json Document enable npm You can start your project 、 Run script 、 Install dependencies 、 Publish to NPM Registry and many other useful tasks
3: install express,blueimp-md5 body-paser mongoose What's the use of backstage ?
express yes node.js The core framework of , Can quickly help us build web The server ( Interface ) To render the project for the backend ,api The server is to create an interface for the front end
blueimp-md5: Make a password md5 encryption
body-paser:express middleware , obtain post Request the submitted data
Then ask again what is a framework ?
An excellent framework , It is equivalent to a template code base , Many basic functions , The underlying functions and operations have been implemented for us , We just need to concentrate on implementing the required business logic .
4,node-modules What's in it ?
npm install After execution , We can do it in node_modules See all dependent packages , what express,mongodb,body-paser,webpack It's all here . To move / Copy / Packaging projects is relatively simple , For development 、 Deployment has benefits
Then I will open it backstage , Because there are many middleware , It's useless if it's not open
app.use("/node-module."express.static(path.join(__dirname,"./node-modules")))
5:post and get When to use ?
post For common resources , Processing forms , Add new data to the database , When adding data rows, use modify and write
get It is used when there are no side effects , It is conducive to adding data rows . For resource acquisition , Read
边栏推荐
猜你喜欢
随机推荐
JS==操作符的强制类型转换规定
p7 day1 初识Flask框架
洛谷陶陶摘苹果
初识C语言——初识指针
First knowledge of C language - why does every C program have a main function
set集合
C语言字符串介绍以及相关操作函数
【codeforces 1695C Zero Path】DP
布局的搭建及天气预报的显示
Hi3516DV300环境搭建
Promise的理解,以及它的实例方法
Introduction and management of heap memory in C language
洛谷超级玛丽游戏
后台频道组管理功能实现
Logic of image uploading
SQL(MySql)菜鸟教程知识
使用vertical-align不能让图片和文字垂直居中对齐
js轮播图
C language makes a small maze
权限展示-左侧列表动态化








